Skip to content

Develop applications

Official cf, application builds, target selection, and CI.

Each application uses cloudflare.config.ts, the official Vite plugin v2, and project-local cf. Bun manages dependencies; Node.js 22.18+ runs cf. See Get started for type generation and build configuration.

Terminal window
bun install --frozen-lockfile
bun run dev
bun run build
ocd cf --target staging deploy --prebuilt --mode staging

cf dev uses official local simulations. ocd cf selects a real OCD authority, injects target credentials, and preserves argv, output, signals, and exit status. It never installs or upgrades tools. Internal CI pins cf@1.0.0-beta.12; users may choose their version. Versions outside 1.0.x warn and still execute.

Concept Meaning Selector
instance Registered local data authority --instance / --config
target Saved API origin, account, and token-file reference ocd cf --target
mode Application mode in the official config callback cf --mode

Target and mode are independent. The launcher does not derive mode from the target name or merge configuration and resource IDs.

Terminal window
ocd cf --project /srv/workers/billing --target production deploy --prebuilt --mode production

Migrate old projects explicitly with cf migrate ./wrangler.jsonc --bundler vite, complete the TODOs, and configure the builder. Without new configuration, the wrapper rejects project operations before reading credentials or contacting the target. Help, resource commands, and valid prebuilt paths remain usable.

Use Dashboard Live Tail for logs; cf currently has no equivalent terminal streaming command. Manage resources and secrets with official commands; discover parameters through cf cli search and command help. Keep secret values out of argv, logs, and the repository.

CI installs the frozen lock, strictly typechecks and builds without deployment credentials, then injects CLOUDFLARE_API_BASE_URL, CLOUDFLARE_ACCOUNT_ID, and CLOUDFLARE_API_TOKEN only for cf deploy --prebuilt. Set CF_SEND_TELEMETRY=false and DO_NOT_TRACK=1. Deploy does not run your package build script, and prebuilt execution is not a sandbox for untrusted code.

With npm use npm install and npm run dev/build; with pnpm use pnpm install --frozen-lockfile and pnpm run dev/build. Install development dependencies with npm install --save-dev / pnpm add -D.