Skip to content

Local development with of dev

of dev runs your worker locally in one command. It deploys on start, redeploys when files change, streams worker logs to the terminal and serves the worker on a loopback address. It is the closest equivalent to wrangler dev.

Terminal window
of dev .
curl http://127.0.0.1:8787/

of dev creates a .vrt/ directory inside the project and supervises these local processes:

Process Role
vrt-host Runs workerd and routes requests to your worker.
vrt-provider Serves binding backends (KV, R2, static assets) to the worker.
vrt-sql Serves D1 databases.

The of process itself acts as a minimal local control plane: it signs the desired state and writes it to disk, and the host picks it up. Pressing Ctrl+C stops every child (SIGTERM, then SIGKILL).

Add .vrt/ to your .gitignore. Deleting it resets all local data.

of dev needs four helper binaries besides of itself:

  • vrt-host, vrt-provider and vrt-sql. of dev looks for each in this order: the explicit flag (--vrt-host-bin, --vrt-provider-bin, --vrt-sql-bin), the same directory as the of executable, then your PATH.
  • A workerd binary, found through --workerd <path>, the VRT_WORKERD environment variable, the directory of the of executable, or your PATH.

A real workerd is checked against the digest pinned in deploy/docker/workerd.lock. A binary that does not match, or a platform without a pinned digest, needs --allow-unpinned-workerd.

Flag Meaning
[<worker_dir>] Project directory. Default ..
--env <name> Select a wrangler [env.<name>] block.
--listen <ip:port> Ingress address. Loopback only. Default 127.0.0.1:8787.
--no-watch Do not redeploy on file changes.
--no-logs Do not print worker logs.
--no-color Disable ANSI colors in log output.
--workerd <path> Path to workerd.
--allow-unpinned-workerd Skip the workerd.lock digest check.
--stub Use the dev-stub runtime (vrt-stub-workerd) instead of workerd. For smoke tests only: it starts the whole stack but does not run your worker’s code.
--vrt-host-bin, --vrt-provider-bin, --vrt-sql-bin Explicit paths to the child binaries.

On start it prints the URL, worker name, environment, runtime (workerd (pinned), workerd (unpinned) or vrt-stub-workerd), a table of bindings and the control address.

Each binding is backed by a real local component, using the same code and configuration as a standalone install. Nothing is mocked.

Binding Backend Local data
KV vrt-provider, filesystem backend .vrt/provider/data/kv
R2 vrt-provider, filesystem backend .vrt/provider/data/r2
D1 vrt-sql, reached by the provider over loopback with a signed token .vrt/sql/data and .vrt/objstore
Durable Objects vrt-host .vrt/do, placement and snapshots in .vrt/objstore/do
Static assets Content-addressed files written at deploy .vrt/provider/data/assets
Vars and secrets JSON files, re-read on every change .vrt/vars/vars.json, .vrt/secrets/secrets.json
Cache API In-memory, per tenant Not persisted
Analytics Engine Spool and Parquet files .vrt/work/ae/

Binding names in your config (a KV id, an R2 bucket_name, a D1 database_id) resolve inside the local .vrt state. You do not need to create resources first, and local data is never copied from Cloudflare or from your OpenFlare.

The standalone server runs a cron scheduler and a queue dispatcher, so cron triggers and Queues consumers are active in of dev. The startup table also lists Postgres, service bindings, Workflows and tail consumers; this documentation has not verified how each of them behaves under of dev, so test them in a real deployment before relying on them. of dev does not apply D1 migrations for you.

  • Any Host header routes to your single worker (devCatchAll), so a plain curl http://127.0.0.1:8787/ works.
  • Durable Object state is single-copy and local, and vrt-sql is allowed to keep its object store on the same disk as its database. Neither gives disaster-recovery guarantees.
  • Hyperdrive is not enabled by default. Postgres credentials are read from a local file.

Put a .dev.vars file (dotenv format) in the project directory. On each deploy:

  • keys that your config declares as secrets fill those secrets;
  • all other keys are merged into vars.

Values are not printed. Keep .dev.vars out of version control.

of dev polls the project directory about every 250 ms and redeploys after changes settle for about 300 ms. A failed redeploy (a syntax error or an invalid config) prints the error and keeps serving the previous version. The loop does not exit.

  • Only the ingress port is user-visible. The control, SQL and metrics listeners use free ephemeral loopback ports, so sessions in different projects do not collide.
  • If the ingress port is in use, of dev fails before starting anything with port <addr> in use. It does not pick another port. Choose one with --listen 127.0.0.1:8788 or a [dev] section in your config (ip, port, and host for an extra route hostname). --listen wins over [dev], which wins over the default.
  • Find the owner of a port on macOS or Linux with lsof -nP -iTCP:8787 -sTCP:LISTEN.
  • Two sessions in different directories run side by side with separate data. Two sessions in the same directory share .vrt, which is protected by a single-writer lock, so the second one is expected to fail.
  • A session serves a single worker. Separate sessions have separate state, so they cannot call each other through service bindings and do not share KV or D1. This is inferred from the design and has not been tested.
  • Each session runs workerd plus three helper processes plus of itself. See Memory use.

Measured on an Apple-silicon Mac with the hello example, --stub runtime and debug builds, about 10 seconds after start (resident set size):

Process RSS
of about 18 MB
vrt-host about 77 MB
vrt-provider about 15 MB
vrt-sql about 11 MB
Total, without workerd about 120 MB

This excludes workerd, which is the largest part of a real session and has not been measured yet. Release builds are typically smaller than debug builds. The Cache API is capped at 128 MiB per tenant and 512 MiB overall, and the GeoIP database (about 100 MB) is downloaded in the background on first start.

Message Cause and fix
socket path budget: socket path is N bytes (max 100) The project path is too deep: the provider socket under .vrt/ must fit in 100 bytes. Move the project to a shorter path.
workerd not found Pass --workerd <path>, set VRT_WORKERD, or use --stub for a smoke test.
workerd digest mismatch vs deploy/docker/workerd.lock or no pinned workerd digest for this platform Use the pinned build, or pass --allow-unpinned-workerd with a compatible OpenFlare workerd.
config.capnp: Struct has no field named 'limits' You passed stock Cloudflare workerd. Use the OpenFlare fork build.
port <addr> in use See Ports and several sessions.
of dev binds loopback only --listen must be a loopback address such as 127.0.0.1:<port>.
--listen must be ip:port Use 127.0.0.1:8788 or [::1]:8788.
VRT_CONFIG_UNSUPPORTED_FIELD The config uses a Cloudflare feature OpenFlare does not implement. See Compatibility.
dev: config reload failed The config became invalid while watching. Fix it and save; the previous version keeps serving.