Configuration explorer
Last updated Sep 29, 2026
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.27.0
defineConfig6 optionsWorker19 optionsBindings37 optionsTriggers5 optionsExports7 options
Expand allCopy
defineConfig
import { defineConfig } from "cf/config";
import * as entrypoint from "./src/index" with { type: "cf-worker" };
<details>
<summary>export default defineConfig(({ isPreview, mode }) => ({ (isPreview, mode reference)</summary>
<code>isPreview</code>Context value<a href="#config-reference-config-configcontext-ispreview">Link to isPreview</a>
<code>isPreview: boolean</code>
Whether the config is being evaluated for a Preview build.
<code>mode</code>Context value<a href="#config-reference-config-configcontext-ispreview">Link to mode</a>
<code>mode: string | undefined</code>
The mode the config is being evaluated in. Set via the <code>--mode</code> CLI flag. In Vite the mode defaults to <code>development</code> in <code>vite dev</code> and <code>production</code> in <code>vite build</code> (<a href="https://vite.dev/guide/env-and-mode.html#modes">more info</a>). In Wrangler the mode defaults to <code>undefined</code>.
</details>
<details>
<summary>accountId: "<ACCOUNT_ID>", (accountId reference)</summary>
<code>accountId</code>Optional<a href="#config-reference-config-settings-accountid">Link to accountId</a>
<code>accountId?: string</code>
This is the ID of the account associated with your zone. It can also be specified through the <code>CLOUDFLARE_ACCOUNT_ID</code> environment variable.
</details>
<details>
<summary>complianceRegion: mode === "fedramp" ? "fedramp-high" : "public", (complianceRegion reference)</summary>
<code>complianceRegion</code>Optional<a href="#config-reference-config-settings-complianceregion">Link to complianceRegion</a>
<code>complianceRegion?: "public" | "fedramp-high"</code>
The compliance boundary in which commands should operate. When omitted, this can be supplied through <code>CLOUDFLARE_COMPLIANCE_REGION</code>.
</details>
<details>
<summary>worker: { (worker reference)</summary>
<code>worker</code>Optional<a href="#config-reference-config-cloudflareconfig-worker">Link to worker</a>
<code>worker?: ConfigInput<WorkerConfig></code>
The Worker defined by this configuration.
</details>
<details>
<summary>name: isPreview ? "example-preview" : "example-worker", (name reference)</summary>
<code>name</code>Required<a href="#config-reference-config-workerconfig-name">Link to name</a>
<code>name: string</code>
The name of your Worker.
</details>
<details>
<summary>entrypoint, (entrypoint reference)</summary>
<code>entrypoint</code>Optional<a href="#config-reference-config-workerconfig-entrypoint">Link to entrypoint</a>
<code>entrypoint?: string | WorkerModule</code>
The entrypoint module that will be executed. May be either a path string (e.g. <code>"./src/index.ts"</code>) or a module namespace imported with the <code>cf-worker</code> import attribute.
</details>
<details>
<summary>compatibilityDate: "<COMPATIBILITY_DATE>", (compatibilityDate reference)</summary>
<code>compatibilityDate</code>Required<a href="#config-reference-config-workerconfig-compatibilitydate">Link to compatibilityDate</a>
<code>compatibilityDate: string</code>
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 <a href="https://developers.cloudflare.com/workers/configuration/compatibility-dates">https://developers.cloudflare.com/workers/configuration/compatibility-dates</a>
</details>
},
<details>
<summary>containers: [], (containers reference)</summary>
<code>containers</code>Optional<a href="#config-reference-config-cloudflareconfig-containers">Link to containers</a>
<code>containers?: ConfigInput<ContainerConfig>[]</code>
Container applications defined by this configuration.
</details>
}));
Worker
import { bindings, defineConfig, exports, triggers } from "cf/config";
import * as entrypoint from "./src/index" with { type: "cf-worker" };
<details>
<summary>export default defineConfig(({ mode }) => ({ (mode reference)</summary>
<code>mode</code>Context value<a href="#config-reference-worker-configcontext-mode">Link to mode</a>
<code>mode: string | undefined</code>
The mode the config is being evaluated in. Set via the <code>--mode</code> CLI flag. In Vite the mode defaults to <code>development</code> in <code>vite dev</code> and <code>production</code> in <code>vite build</code> (<a href="https://vite.dev/guide/env-and-mode.html#modes">more info</a>). In Wrangler the mode defaults to <code>undefined</code>.
</details>
<details>
<summary>worker: { (worker reference)</summary>
<code>worker</code>Optional<a href="#config-reference-worker-cloudflareconfig-worker">Link to worker</a>
<code>worker?: ConfigInput<WorkerConfig></code>
The Worker defined by this configuration.
</details>
<details>
<summary>name: mode === "staging" ? "images-staging" : "images", (name reference)</summary>
<code>name</code>Required<a href="#config-reference-worker-workerconfig-name">Link to name</a>
<code>name: string</code>
The name of your Worker.
</details>
<details>
<summary>compatibilityDate: "<COMPATIBILITY_DATE>", (compatibilityDate reference)</summary>
<code>compatibilityDate</code>Required<a href="#config-reference-worker-workerconfig-compatibilitydate">Link to compatibilityDate</a>
<code>compatibilityDate: string</code>
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 <a href="https://developers.cloudflare.com/workers/configuration/compatibility-dates">https://developers.cloudflare.com/workers/configuration/compatibility-dates</a>
</details>
<details>
<summary>compatibilityFlags: ["nodejs_compat"], (compatibilityFlags reference)</summary>
<code>compatibilityFlags</code>Optional<a href="#config-reference-worker-workerconfig-compatibilityflags">Link to compatibilityFlags</a>
<code>compatibilityFlags?: string[]</code>
A list of flags that enable features from upcoming features of the Workers runtime, usually used together with <code>compatibilityDate</code>. More details at <a href="https://developers.cloudflare.com/workers/configuration/compatibility-flags/">https://developers.cloudflare.com/workers/configuration/compatibility-flags/</a>
Default: <code>[]</code>
</details>
<details>
<summary>entrypoint, (entrypoint reference)</summary>
<code>entrypoint</code>Optional<a href="#config-reference-worker-workerconfig-entrypoint">Link to entrypoint</a>
<code>entrypoint?: string | WorkerModule</code>
The entrypoint module that will be executed. May be either a path string (e.g. <code>"./src/index.ts"</code>) or a module namespace imported with the <code>cf-worker</code> import attribute.
</details>
<details>
<summary>assets: { (assets reference)</summary>
<code>assets</code>Optional<a href="#config-reference-worker-workerconfig-assets">Link to assets</a>
<code>assets?: { / How to handle HTML requests. */ htmlHandling?: "auto-trailing-slash" | "drop-trailing-slash" | "force-trailing-slash" | "none"; / How to handle requests that do not match an asset. / notFoundHandling?: "single-page-application" | "404-page" | "none"; / * The public URL prefix under which the application is served. / basePath?: string; /* * Matches will be routed to the User Worker, and matches to negative rules will go to the Asset Worker. * * Can also be true, indicating that every request should be routed to the User Worker. / runWorkerFirst?: string[] | boolean; }</code>
Specify the directory of static assets to deploy/serve. More details at <a href="https://developers.cloudflare.com/workers/frameworks/">https://developers.cloudflare.com/workers/frameworks/</a> For reference, see <a href="https://developers.cloudflare.com/workers/wrangler/configuration/#assets">https://developers.cloudflare.com/workers/wrangler/configuration/#assets</a>
</details>
<details>
<summary>htmlHandling: "auto-trailing-slash", (htmlHandling reference)</summary>
<code>htmlHandling</code>Optional<a href="#config-reference-worker-workerconfig-assets-htmlhandling">Link to htmlHandling</a>
<code>htmlHandling?: "auto-trailing-slash" | "drop-trailing-slash" | "force-trailing-slash" | "none"</code>
How to handle HTML requests.
</details>
},
<details>
<summary>domains: ["images.example.com"], (domains reference)</summary>
<code>domains</code>Optional<a href="#config-reference-worker-workerconfig-domains">Link to domains</a>
<code>domains?: Array<string | CustomDomain></code>
Custom domains that your Worker should be published to. Strings serve production traffic only. Objects select production, Preview traffic, or both; at least one must be enabled. Domain settings are applied when deploying the parent Worker. Preview uploads use the parent's existing hosting without applying domains. For reference, see <a href="https://developers.cloudflare.com/workers/wrangler/configuration/#types-of-routes">https://developers.cloudflare.com/workers/wrangler/configuration/#types-of-routes</a>
</details>
<details>
<summary>triggers: [ (triggers reference)</summary>
<code>triggers</code>Optional<a href="#config-reference-worker-workerconfig-triggers">Link to triggers</a>
<code>triggers?: Trigger[]</code>
Event triggers — fetch routes, queue consumers, cron schedules, Email Routing addresses, and raw sockets — that invoke this Worker. Construct entries with <code>triggers.fetch(...)</code>, <code>triggers.queue(...)</code>, <code>triggers.scheduled(...)</code>, <code>triggers.email(...)</code>, or <code>triggers.connect(...)</code>. For reference, see <a href="https://developers.cloudflare.com/workers/wrangler/configuration/#triggers">https://developers.cloudflare.com/workers/wrangler/configuration/#triggers</a>
</details>
<details>
<summary>triggers.scheduled({ (scheduled reference)</summary>
<code>scheduled</code>Builder<a href="#config-reference-worker-triggers-scheduled-default">Link to scheduled</a>
<code>scheduled(options: ScheduledTriggerOptions): ScheduledTrigger;</code>
Scheduled (cron) trigger — invokes this Worker on the given schedules. More details here <a href="https://developers.cloudflare.com/workers/platform/cron-triggers">https://developers.cloudflare.com/workers/platform/cron-triggers</a>
<details>
<summary>Options (1)</summary>
<dl>
<dt><code>schedule: string</code></dt> <dd>A "cron" definition to trigger a Worker's "scheduled" function. Lets you call Workers periodically, much like a cron job. More details here <a href="https://developers.cloudflare.com/workers/platform/cron-triggers">https://developers.cloudflare.com/workers/platform/cron-triggers</a></dd>
</dl></details>
</details>
<details>
<summary>schedule: "0 * * * *", (schedule reference)</summary>
<code>schedule</code>Required<a href="#config-reference-worker-triggers-scheduled-default-schedule">Link to schedule</a>
<code>schedule: string</code>
A "cron" definition to trigger a Worker's "scheduled" function. Lets you call Workers periodically, much like a cron job. More details here <a href="https://developers.cloudflare.com/workers/platform/cron-triggers">https://developers.cloudflare.com/workers/platform/cron-triggers</a>
</details>
}),
],
<details>
<summary>tailConsumers: [ (tailConsumers reference)</summary>
<code>tailConsumers</code>Optional<a href="#config-reference-worker-workerconfig-tailconsumers">Link to tailConsumers</a>
<code>tailConsumers?: Array<{ / The name of the service tail events will be forwarded to. */ worker: string; / Whether to stream tail events in real time. */ streaming?: boolean; }></code>
A list of Tail Workers that are bound to this Worker. <code>@cloudflare/config</code> unifies regular and streaming tail consumers under a single field; pass <code>streaming: true</code> to forward streaming tail events.
Default: <code>[]</code>
</details>
{
<details>
<summary>worker: "log-sink", (worker reference)</summary>
<code>worker</code>Required<a href="#config-reference-worker-workerconfig-tailconsumers-worker">Link to worker</a>
<code>worker: string</code>
The name of the service tail events will be forwarded to.
</details>
<details>
<summary>streaming: true, (streaming reference)</summary>
<code>streaming</code>Optional<a href="#config-reference-worker-workerconfig-tailconsumers-streaming">Link to streaming</a>
<code>streaming?: boolean</code>
Whether to stream tail events in real time.
</details>
},
],
<details>
<summary>cache: { (cache reference)</summary>
<code>cache</code>Optional<a href="#config-reference-worker-workerconfig-cache">Link to cache</a>
<code>cache?: { / If cache is enabled for this Worker. */ enabled: boolean; / Whether cached assets may be reused across Worker versions. */ crossVersionCache?: boolean; }</code>
Specify the cache behavior of the Worker.
</details>
<details>
<summary>enabled: true, (enabled reference)</summary>
<code>enabled</code>Required<a href="#config-reference-worker-workerconfig-cache-enabled">Link to enabled</a>
<code>enabled: boolean</code>
If cache is enabled for this Worker.
</details>
<details>
<summary>crossVersionCache: true, (crossVersionCache reference)</summary>
<code>crossVersionCache</code>Optional<a href="#config-reference-worker-workerconfig-cache-crossversioncache">Link to crossVersionCache</a>
<code>crossVersionCache?: boolean</code>
Whether cached assets may be reused across Worker versions.
</details>
},
<details>
<summary>placement: { (placement reference)</summary>
<code>placement</code>Optional<a href="#config-reference-worker-workerconfig-placement">Link to placement</a>
<code>placement?: { mode: "off" | "smart"; hint?: string; } | { mode?: "targeted"; region: string; } | { mode?: "targeted"; host: string; } | { mode?: "targeted"; hostname: string; }</code>
Specify how the Worker should be located to minimize round-trip time. More details: <a href="https://developers.cloudflare.com/workers/platform/smart-placement/">https://developers.cloudflare.com/workers/platform/smart-placement/</a>
</details>
<details>
<summary>mode: "smart", (mode reference)</summary>
<code>mode</code>Required<a href="#config-reference-worker-workerconfig-placement-mode">Link to mode</a>
<code>mode: "off" | "smart"</code>
The type definition does not include a description.
</details>
},
<details>
<summary>limits: { (limits reference)</summary>
<code>limits</code>Optional<a href="#config-reference-worker-workerconfig-limits">Link to limits</a>
<code>limits?: { / Maximum allowed CPU time for a Worker's invocation in milliseconds. */ cpuMs?: number; / Maximum allowed number of fetch requests that a Worker's invocation can execute. */ subrequests?: number; }</code>
Specify limits for runtime behavior. Only supported for the "standard" Usage Model. For reference, see <a href="https://developers.cloudflare.com/workers/wrangler/configuration/#limits">https://developers.cloudflare.com/workers/wrangler/configuration/#limits</a>
