Skip to content

Configuration explorer

Last updated View as MarkdownAgent setup

cloudflare.config.ts is a TypeScript file, so every field has a type and a description. Use the configuration explorer to see how the file describes the main parts of an application: project settings, the Worker, bindings, triggers, and exports.

Select a category, then select a highlighted field to see its type, description, default value, and accepted options. Editors with TypeScript support show the same information in autocomplete and hover text as you write the file, and type checking flags values that do not match.

To learn how to structure a project's configuration, refer to Programmatic configuration. To return different configuration for each environment, refer to Modes.

Select a highlighted line to show its type and description below it.

Generated from @cloudflare/config0.20.0

defineConfig

import { defineConfig } from "cf/config";
import * as entrypoint from "./src/index" with { type: "cf-worker" };
export default defineConfig(({ isPreview, mode }) => ({ (isPreview, mode reference)

isPreviewContext valueLink to isPreview

isPreview: boolean

Whether the config is being evaluated for a Preview build.

modeContext valueLink to mode

mode: string | undefined

The mode the config is being evaluated in. Set via the --mode CLI flag. In Vite the mode defaults to development in vite dev and production in vite build (more info). In Wrangler the mode defaults to undefined.

accountId: "<ACCOUNT_ID>", (accountId reference)

accountIdOptionalLink to accountId

accountId?: string

This is the ID of the account associated with your zone. It can also be specified through the CLOUDFLARE_ACCOUNT_ID environment variable.

complianceRegion: mode === "fedramp" ? "fedramp-high" : "public", (complianceRegion reference)

complianceRegionOptionalLink to complianceRegion

complianceRegion?: "public" | "fedramp-high"

The compliance boundary in which commands should operate. When omitted, this can be supplied through CLOUDFLARE_COMPLIANCE_REGION.

worker: { (worker reference)

workerOptionalLink to worker

worker?: ConfigInput<WorkerConfig>

The Worker defined by this configuration.

name: isPreview ? "example-preview" : "example-worker", (name reference)

nameRequiredLink to name

name: string

The name of your Worker.

entrypoint, (entrypoint reference)

entrypointOptionalLink to entrypoint

entrypoint?: string | WorkerModule

The entrypoint module that will be executed. May be either a path string (e.g. "./src/index.ts") or a module namespace imported with the cf-worker import attribute.

compatibilityDate: "<COMPATIBILITY_DATE>", (compatibilityDate reference)

compatibilityDateRequiredLink to compatibilityDate

compatibilityDate: string

A date in the form yyyy-mm-dd, which will be used to determine which version of the Workers runtime is used. More details at https://developers.cloudflare.com/workers/configuration/compatibility-dates

},
containers: [], (containers reference)

containersOptionalLink to containers

containers?: ConfigInput<ContainerConfig>[]

Container applications defined by this configuration.

}));

Was this helpful?