Getting started
Projects that use cloudflare.config.ts
Run a Worker project that Cloudflare's cf CLI configures with cloudflare.config.ts, without a Wrangler config.
Projects that cf init creates, or that cf migrate converts, keep their
configuration in cloudflare.config.ts instead of wrangler.jsonc. Orange
runs these projects as they are. It evaluates the file with the cf package
that the project installs, so you keep one configuration for Cloudflare and
Orange.
Quickstart
You need Node.js 22.18 or later, as cf does, and cf in the project’s
dependencies. cf init adds it, and cf migrate adds it when its install works.
-
Install the project's packages
npm install -
Run the Worker
Run this in the directory that holds
cloudflare.config.ts.orange dev -
Deploy it
orange deploy
Select a mode
cf selects a mode with --mode. Orange passes --env as the mode, as
Wrangler does for cloudflare.config.ts, so a function-form config returns the
config for that mode.
orange dev --env staging
Keep a Wrangler config next to it
When a directory has both files, Orange runs neither on its own. Pass the one
to run with --config.
orange dev --config wrangler.jsonc
AI context How Orange reads the file, supported fields, errors, and gaps
Written for LLMs and coding agents: every edge case, measurement, and known deviation. You do not need it to use the feature.
How Orange reads cloudflare.config.ts
- Orange resolves
cffrom the project, then loads the@cloudflare/configpackage that thiscfdepends on. It calls Cloudflare’s ownloadAndParseConfigwithisPreview: falseand the mode, andconvertToWranglerConfigon the result. Wrangler then reads that config as it reads awrangler.json, and Orange runs it as it runs any Wrangler config. - Orange does not add
cfto its own dependencies. Thecfrelease in the project decides how the file evaluates, as it does forcf dev. - Orange finds
cloudflare.config.tsin the working directory only, ascfdoes for project commands.--configalso takes a path to a.ts,.mts,.js, or.mjsconfig. - The project directory is the directory of
cloudflare.config.ts. Orange reads.dev.varsand.dev.vars.<mode>there, as Wrangler does forcf dev. --env <name>is the mode. Without--env,CLOUDFLARE_ENVis the mode, as in Wrangler. Without either, the mode isundefined, as withcf devon the Wrangler bundler. Orange does not take--mode.- Modes with the same Worker name share Durable Object and D1 state, as on Cloudflare, where they deploy the same Worker.
orange deployevaluates the file once on your machine, in the selected mode, bundles the Worker that it names, and writes the result into the image ascloudflare.config.orange.json. The image runsorange serve --config cloudflare.config.orange.json, so it needs nocfand nonode_modules, and the image leavescloudflare.config.tsout. The file has anopenOrangeGeneratedFromkey, and with it the image ignoresCLOUDFLARE_ENV, so a runner that sets it runs the same Worker. A Wrangler config of your own with that name still readsCLOUDFLARE_ENV.- The image leaves out what
devoptions set, which onlycf devreads: R2dev.experimentalS3Credentials, Hyperdrivedev.connectionString, andaccess.dev. A runner reads a Hyperdrive connection string from itsCLOUDFLARE_HYPERDRIVE_LOCAL_CONNECTION_STRING_<BINDING>variable, asorange servedoes for any Worker, and stops at startup without one.orange deployreads and checks no connection string on your machine. Set it on the runner pool withorange deploy --secrets-file, or with-eon a self-hosteddocker run. See Hyperdrive. - The image also leaves out a container’s build context and build variables, because Orange builds no container image.
- Relative paths in the file, such as a container’s Dockerfile, are from the
directory of
cloudflare.config.ts. A Dockerfile’s real path, after symlinks, must be inside the project, in a directory thatorange deploycopies. The image names it by that path in the project.
Supported fields
Every field that convertToWranglerConfig writes goes through the same checks as
a wrangler.jsonc. These are tested end to end:
In cloudflare.config.ts | On Orange |
|---|---|
worker.name, entrypoint, compatibilityDate, compatibilityFlags | As name, main, compatibility_date, compatibility_flags. entrypoint takes a path or a cf-worker import. |
bindings.text(), bindings.json() | Variables. |
bindings.secret() | A required secret, read from .dev.vars. |
bindings.kv(), bindings.d1(), bindings.r2() | KV, D1, and R2 bindings. d1() works with only name. |
bindings.durableObject() and exports.durableObject({ storage }) | A Durable Object binding and its class, with SQLite storage. See Durable Objects. |
bindings.worker() | A service binding. |
defineContainer() in containers, linked by exports.durableObject({ container }) | The class runs on ORANGE_SANDBOX_PROVIDER, as a Container class in a wrangler.jsonc does. Tested with @cloudflare/sandbox exec() on the default local provider. See Sandbox. |
triggers.scheduled() | A cron trigger. |
Errors
| Error | Cause |
|---|---|
OpenOrange found both cloudflare.config.ts and wrangler.jsonc in <directory>, and does not pick one. Pass --config cloudflare.config.ts or --config wrangler.jsonc. | The directory has both configs, and no --config picks one. Orange stops so that a project never switches configs, and Durable Object storage, without you choosing it. |
OpenOrange runs cloudflare.config.ts on Node.js 22.18 or later, as cf does. … | Node.js is older than 22.18, which cf’s loader needs. |
OpenOrange cannot find the cf package, which <path> imports. Install it in the project … | cf is not installed in the project. |
<path> threw while Orange evaluated it: <message> | The config threw, such as the throw that cf migrate adds until you resolve its TODO items. |
<path> is not a valid Cloudflare configuration: and one line for each field | cf’s schema refused a field, such as an unknown key. |
<path> defines no worker. … | The default export has no worker. |
OpenOrange does not read wrangler.config.ts yet. … | The project keeps build settings in wrangler.config.ts. |
Unsupported Wrangler configuration: … or Unknown Wrangler configuration fields: … | A field that Orange refuses in a wrangler.jsonc too, under its Wrangler name. |
OpenOrange writes the config it evaluated to cloudflare.config.orange.json, and the project already has a file with that name. … | orange deploy found a project file with the name of the file it generates. |
OpenOrange copies only the project into the image, so containers[<n>]'s Dockerfile <path> must be inside <project>. … | orange deploy found a container Dockerfile whose real path is outside the project. |
OpenOrange did not copy containers[<n>]'s Dockerfile <path> into the image, … | The Dockerfile is in a directory that orange deploy leaves out, such as .wrangler or node_modules. |
OpenOrange cannot delete the storage of a Durable Object class yet, so exports.<Class> cannot be "deleted". … | An exports entry has state: "deleted". |
Gaps
wrangler.config.ts, which holds build settings such as the assets directory and the build command for projects that build with Wrangler, is not read. Orange stops with an error when it exists.- Static assets:
cloudflare.config.tshas no assets directory.cftakes it from Vite or fromwrangler.config.ts, and Orange reads neither. exports.workflow()andbindings.workflow(): the pinned Wrangler 4.129.0 refuses a Workflow inexports.exports.durableObject()withstate: "renamed"or"transferred"stops with an error.exports.durableObject({ state: "deleted" })stops with an error, because Orange cannot delete a class’s objects yet. Remove the entry and the class’s bindings instead. Orange keeps the objects, and a class created again under that name finds them, so give a class that must start empty a new name.isPreviewis alwaysfalse. Orange has no Worker Previews.orange typesstops with an error, before it evaluates the file. Runcf workers types.orange migrate preparestops with an error, before it evaluates the file. Run it with--configand the Wrangler config thatcf migrateconverted.orange doctormarks each Durable Object class as one that does not move.