`of` CLI reference
of is the OpenFlare command-line tool. It reads a Cloudflare-style worker project (wrangler.toml, wrangler.json, wrangler.jsonc, or cloudflare.config.ts), bundles it, and deploys it to an OpenFlare control plane. It also manages the data resources that workers bind to (KV, R2, D1, Queues, and others).
This page covers the commands you use against a control plane (the Docker-based OpenFlare you install in this documentation). The same binary also has a standalone mode (--root <dir>, of init, of serve, of dev) that runs a single-machine stack without a control plane; those commands are listed briefly at the end.
Install
Section titled “Install”Prebuilt binaries exist for linux-x64, linux-arm64, macOS x64 and macOS arm64. The runtime repository (becoolme/openflare) ships an installer script that detects the platform, downloads the matching asset and its .sha256, refuses a checksum mismatch, and installs to /usr/local/bin/of (override the prefix with OF_PREFIX):
curl -fsSL https://raw.githubusercontent.com/becoolme/openflare/main/scripts/install-of.sh -o install-of.shsh install-of.sh # latest releasesh install-of.sh of-vX.Y.Z # a specific release tagof --versionYou can also build from source with Rust stable:
cargo build --release -p vrt-local --bin ofinstall -m0755 target/release/of /usr/local/bin/ofof --version (also -V and version) prints of <release tag>.
The CLI is Unix-only: credential files must have Unix mode 0600.
Connect to a control plane
Section titled “Connect to a control plane”Control-plane commands use a profile: a saved URL, token, cell and team. You create one with of login.
of login
Section titled “of login”of login [--url <url>] [--profile <name>] [--token-file <path>] [--cell <id>] [--team <id>]of login --browser --console-url <console origin> [--url <plane api>] [--profile <name>]| Flag | Meaning |
|---|---|
--url |
Plane API origin. Falls back to the OF_PLANE_URL environment variable, then to http://127.0.0.1:8787. |
--profile |
Profile name to save. Default default. 1-63 characters: ASCII alphanumeric first, then letters, digits, ., _ or -. |
--token-file |
File that contains the plane token. It must have mode 0600. If you omit the flag, the token is read from standard input. |
--browser |
Sign in through your browser instead of pasting a token (see below). |
--console-url |
Console origin that serves the approval page. With --browser only. Falls back to OF_CONSOLE_URL. |
--cell |
Cell to deploy to. Required when the plane has more than one cell. |
--team |
Team to deploy under. Required when the plane has more than one team. |
What it does:
- Validates the URL. It must be the API origin only (no path, query, fragment or user info). Plain
http://is accepted only for loopback hosts (localhost,*.localhost,127.0.0.1,::1); every other host must usehttps://, so the bearer token is never sent in plaintext across a network. - Validates the token: 32-256 printable ASCII characters, no whitespace.
- Calls
GET /api/v1/cellswith the token. A wrong token or unreachable plane fails here, before anything is saved. - Picks the cell and team. A single cell or team is chosen automatically. If you pass
--cell, it must already exist (cells are infrastructure and are never created implicitly). If you pass a--teamthat does not exist,of logincreates it. If the plane has no teams and you pass none, it creates a team namedlocal. - Saves the profile and makes it the current profile. It prints a JSON summary (
profile,url,cellId,teamId,createdTeam,config).
# the plane admin token (PLANE_ADMIN_TOKEN) is read from stdinprintf '%s' "$PLANE_ADMIN_TOKEN" | of login --url https://plane.example.com --team acmeBrowser login
Section titled “Browser login”of login --browser --console-url https://console.example.com --url https://plane.example.comof starts a one-shot listener on 127.0.0.1, opens the console’s approval page and waits (5 minutes). After you click Approve, the browser returns to your terminal and the CLI receives a new API key. The flow uses PKCE: the approval code is single-use, lives two minutes, and is useless without a verifier that never leaves the CLI process.
The key has full access (* scope), expires after 90 days and appears under API keys in the console, where you can revoke it. Only an admin signed in to the console can approve. --url is still the plane API origin: the console origin does not accept API keys.
With a token file or stdin, the token you log in with is the plane administrator token (PLANE_ADMIN_TOKEN). Treat the saved profile like a password. See Security.
Profile commands
Section titled “Profile commands”| Command | What it does |
|---|---|
of profiles |
Lists saved profiles, one per line: * marks the current one, followed by URL, cell and team. |
of whoami [--profile <name>] |
Calls GET /api/v1/cells with the profile and prints {profile, url, cellId, teamId, reachable, cells}. Use it to check that credentials still work. |
of logout [--profile <name>] |
Removes a profile from the config file. |
Where profiles are stored
Section titled “Where profiles are stored”The config file is config.json, located by the first match of:
$OF_CONFIG_HOME/config.json$XDG_CONFIG_HOME/openflare/config.json$HOME/.config/openflare/config.json
The file must have mode 0600, otherwise of refuses to use it and tells you to chmod 600 it.
Profile selection
Section titled “Profile selection”Every control-plane command accepts --profile <name>. If you omit it, of uses the OF_PROFILE environment variable, then the profile that of login last set as current.
Environment variables
Section titled “Environment variables”| Variable | Used by | Meaning |
|---|---|---|
OF_PLANE_URL |
of login |
Default for --url. |
OF_PROFILE |
all control-plane commands | Profile to use when --profile is absent. |
OF_CONFIG_HOME |
all control-plane commands | Directory that holds config.json. |
XDG_CONFIG_HOME, HOME |
config lookup | Fallback config locations (see above). |
OF_PREFIX |
install-of.sh |
Install prefix for the binary. |
OF_BUNDLER |
of deploy, of check, of build |
Explicit path to the of-bundler helper. Normally not needed: release binaries embed the bundler. |
VRT_NODE_BIN |
config loading | Node.js binary used to evaluate cloudflare.config.ts/.js (default: node on PATH). |
VRT_WORKERD_BIN, OF_WORKERD_BIN |
--config-sandbox worker |
Path to a workerd binary used to evaluate config. |
VRT_WORKERD |
of dev |
Path to the workerd binary (the --workerd flag wins). |
VRT_STUB_WORKERD |
of dev --stub |
Path to vrt-stub-workerd. |
VRT_CF_CONFIG_LOADER |
config loading | Override path to the config loader script. |
VRT_CF_CONFIG_LOADER_TIMEOUT_MS |
config loading | Loader deadline (default 60000 ms, bounded to 100-600000). |
VRT_CF_CONFIG_SANDBOX_TIMEOUT_MS |
--config-sandbox worker |
Sandbox deadline (default 5000 ms, bounded to 100-30000). |
RUST_LOG |
all | Log filter for the CLI’s own logging (default info). |
Exit codes
Section titled “Exit codes”| Code | Meaning |
|---|---|
0 |
The command succeeded. |
1 |
Any failure. The message is printed to standard error as of: <message>. Running of with no command prints the usage text and exits with 1. |
of doctor exits 1 when a check fails (with --strict, warnings count as failures). The CLI has no other distinct exit codes.
Build, check and deploy
Section titled “Build, check and deploy”of check and of build
Section titled “of check and of build”of check [--env <name>] [--var KEY:VALUE]... [--tag <t>] [--config-sandbox node|worker] <worker_dir>of build [same flags] <worker_dir>of build --format openflare-artifact --output <dir> [--env <name>] [--var KEY:VALUE]... [--tag <t>] [--name <n>] [--config-sandbox node|worker] <worker_dir>of check is an offline gate. It runs the same configuration normalization, bundling and validation that a real deploy runs, writes nothing, and needs no connection. It prints a JSON report and exits 0 on success. Checks that depend on server state (service-binding targets, secret values, cell capabilities) are left to the server.
of build without --format is the same as of check. With --format openflare-artifact --output <dir> it writes a verifiable deployment artifact directory. --output is only valid with --format, and openflare-artifact is the only supported format.
of artifact verify [--json] <artifact-dir>Verifies an artifact directory and prints a summary (bundleDigest, modules, asset manifest and object counts), or JSON with --json.
of deploy
Section titled “of deploy”of deploy [--profile <name>] [--env <name>] [--secrets-file <file|->] [--var KEY:VALUE]... [--name <n>] [--tag <t>] [--config-sandbox node|worker] [--dry-run] <worker_dir>With no --root and no --url, of deploy deploys through the control plane selected by the profile.
| Flag | Meaning |
|---|---|
<worker_dir> |
Required. Project directory that holds the worker configuration. |
--profile |
Control-plane profile to use. |
--env <name> |
Select a named environment from the config ([env.<name>]). If the config defines environments and you omit --env, the command fails and lists the available names. |
--secrets-file <file|-> |
A dotenv-style file of KEY=VALUE lines (# comments allowed) with secret values; - reads standard input. Each key is uploaded as a secret before the version is created. |
--var KEY:VALUE |
Override or add a variable. Repeatable. The value is always a string. The key must not be empty. |
--name <n> |
Override the worker name from the config. Must be a valid worker name (lowercase letters, digits and -, 1-63 characters, starting with a letter or digit). |
--tag <t> |
Attach a human-readable tag to the version (at most 128 UTF-16 code units). Visible to the worker through the version-metadata binding. An empty tag means untagged. |
--config-sandbox node|worker |
How a cloudflare.config.* file is evaluated: node (default; a restricted child process, not a sandbox) or worker (a workerd dynamic worker with no host filesystem or network; needs VRT_WORKERD_BIN). |
--dry-run |
Gather and validate the project and print a JSON summary; nothing is sent. |
--preview is accepted by the parser, but a control-plane deploy rejects it (control-plane deploy does not support --preview yet).
The deploy runs these steps:
- Reads and normalizes the configuration, then bundles
mainand its import graph into one ES module with the bundledof-bundler(rolldown).cloudflare:*andnode:*imports stay external. - Resolves every binding against the plane (KV namespaces, R2 buckets, D1 databases, queues, service targets, Hyperdrive, Secrets Store, Vectorize, Durable Object classes, and so on). A binding that points to a resource that does not exist yet fails the deploy before anything is changed. Create resources first (see below).
- Creates the worker if it does not exist, upserts workflow declarations, uploads static-asset objects and the manifest, and uploads secret values from
--secrets-file. - Submits the version with
activate: trueandpublish: truetoPOST .../workers/{name}/deploy-source. - Attaches hostnames declared in config (see Hostnames).
It prints a JSON summary:
{ "worker": "hello", "cellId": "default", "teamId": "acme", "versionId": "v-...", "bundleDigest": "...", "activated": true, "revision": 12, "secretsUploaded": 1, "flagshipAppsSynced": 0, "workflowsSynced": 0, "durableObjectClassesDeclared": 0, "assetManifest": null, "assetObjects": null, "hostnamesAttached": 0}Rules and refusals worth knowing:
- A declared secret binding must have a value, either in
--secrets-fileor already stored for that worker (of secret put). Otherwise the deploy fails before creating a new worker. - A secret name must not collide with a var, and all binding names must be unique across vars, secrets, bindings, workflows and version metadata. At most 64 bindings are accepted.
- Module files must be non-empty UTF-8 text.
- If the active version of an existing worker uses features the CLI cannot reproduce (a binding type outside the translated set, or a
cachesetting), the deploy refuses withexisting worker has control-plane features this CLI cannot reproduce yet; refusing to replace them. Use the console or the API for those workers. - Wrangler
[vars]keep their types: strings stay plain vars, while numbers, booleans, null, arrays and objects become typed JSON variables (at most 16 KiB each when encoded). - If a worker config declares no
vars, the version inherits the vars currently stored for the worker (so values set in the console are not wiped). Once the config declares vars, the config is authoritative for the whole set.
Cloudflare configuration keys that OpenFlare does not implement fail the deploy with VRT_CONFIG_UNSUPPORTED_FIELD; see Compatibility.
Hostnames
Section titled “Hostnames”of hostnames ls [--profile <name>] --worker <name>of hostnames add [--profile <name>] --worker <name> <hostname>of hostnames rm [--profile <name>] --worker <name> <hostname>ls prints the worker’s hostnames. add claims a custom hostname and rm releases it. During of deploy, hostnames from routes with custom_domain = true (and native hostnames) are claimed automatically, and plain pattern routes must refer to a hostname already attached and verified on the worker. of deploy never deletes hostname rows; a custom hostname that exists on the worker but not in config makes the deploy fail before it changes anything, so either declare it in config or remove it with of hostnames rm.
Versions, rollback, status, logs, delete
Section titled “Versions, rollback, status, logs, delete”| Command | What it does |
|---|---|
of versions list [--profile <name>] --worker <name> |
Prints the worker’s version records as JSON. (of versions is an alias for list in standalone mode.) |
of rollback [--profile <name>] --worker <name> <version_id> |
Activates an existing version (POST .../versions/{version}/activate) and publishes the cell. It does not create a new version. |
of status [--profile <name>] --worker <name> |
Prints the worker detail: metadata, active version, versions, vars, secret key names (never values) and hostnames. |
of logs [--profile <name>] --worker <name> [--limit <n>] |
Prints a bounded snapshot of recent logs. --limit is clamped to 1-1000 (default 100). --follow, --since and --level are rejected in control-plane mode. |
of delete [--profile <name>] --worker <name> |
Deletes the worker and publishes the cell. The plane refuses while the worker is still referenced as a tail consumer, a workflow target, or a Durable Object transfer source. |
Secrets
Section titled “Secrets”Secret values are read from standard input or a file, never from command-line arguments.
of secret put [--profile <name>] --worker <name> <KEY> # value on stdinof secret bulk [--profile <name>] --worker <name> [file|-] [--format json|dotenv]of secret rm [--profile <name>] --worker <name> <KEY>of secret ls [--profile <name>] --worker <name> # names onlyof secret bulk takes a JSON object ({"KEY":"value"}, where null deletes a key) or a dotenv file, from a file or standard input. Secret writes and deletes are published as configuration revisions and reach the cell asynchronously.
printf '%s' "$DB_PASSWORD" | of secret put --worker api DB_PASSWORDof secret ls --worker apiData resources
Section titled “Data resources”All of these use the profile’s cell and team. Resource commands that submit work to the cell wait for the result; --wait-ms <n> sets how long (default 10000, maximum 30000). A timeout means the outcome is unknown, not that the operation failed. A write may still complete later, so check before you retry.
of kv namespace list|create|delete [args]of kv key list (--namespace-id <id> | --namespace <title|id>) [--prefix <p>] [--cursor <c>] [--limit <n>]of kv key get|delete <key> (--namespace-id <id> | --namespace <title|id>)of kv key put <key> [value] (--namespace-id <id> | --namespace <title|id>) [--path <file|->] [--expiration <unix-s>] [--expiration-ttl <s>] [--metadata <json>]of kv bulk put|delete [json-file|-] (--namespace-id <id> | --namespace <title|id>)--namespaceresolves a unique title or id and fails when it is ambiguous.--namespace-iduses the id directly.puttakes an inline value,--path <file>or--path -, or standard input when neither is given. Values must be UTF-8 and at most 1 MiB through the control plane.--expiration-ttlmust be at least 60 seconds and cannot be combined with--expiration.getreturns a UTF-8valueview and a losslessvalueBase64.bulk putreads a JSON array of 1-1000 objects with stringkeyandvalue(plus optional expiration and metadata);bulk deletereads 1-1000 keys. Each value is at most 1 MiB and decoded values total at most 8 MiB. Duplicate keys are rejected up front. Batches are validated as a whole, but they are not atomic once writes start.- Every command also accepts
--wait-msand--profile.
of r2 bucket list|create|delete [args]of r2 object list --bucket <name> [--prefix <p>] [--cursor <c>] [--limit <n>] [--delimiter <d>]of r2 object head <key> --bucket <name>of r2 object get <key> --bucket <name> [--output <file|->]of r2 object put <key> [body] --bucket <name> [--file <file|->] [--content-type <type>] [--metadata <json>]of r2 object delete <key> [key...] --bucket <name>puttakes a small inline body,--file <path>or--file -, or standard input. File and stdin bodies are binary-safe.--metadatamust be a JSON object whose values are strings.getprints JSON includingbodyBase64. With--output <path>the exact bytes are written (mode0600) and the body fields are omitted from the JSON;--output -writes only the raw bytes to standard output.deleteaccepts up to 1000 keys.- A single control-plane object operation is limited to 4 MiB at the cell, and the plane caps each serialized JSON request at 1 MiB. Because bodies are base64-encoded, the practical object size through the CLI is well under 1 MiB. Use the S3-compatible runtime path from a worker for larger objects.
of d1 list|create|delete [args]of d1 query (<name|database-id> | --database-id <id>) [--sql <sql> | --file <file|->] [--params <json-array>]of d1 migrations list|status|apply (<name|database-id> | --database-id <id>) [--file <json|->] [--migration <name=path>]... [--config <wrangler-file>] [--env <name>]of d1 migrations create <name|binding> <message> [--config <wrangler-file>] [--env <name>]of d1 promote (<name|database-id> | --database-id <id>) [--expected-epoch <n> --expected-lsn <n>]of d1 promotions|stats|info (<name|database-id> | --database-id <id>)d1 create <name>creates a database (the name is a display name; the real id is generated by the platform).d1 deleteis refused with a conflict while a version references the database; otherwise it submits an asynchronous drop and waits.querytakes SQL from--sql,--file, or standard input, limited to 100 KiB.--paramsis a JSON array of at most 100 values.migrations applyaccepts a JSON array (--file) or repeated--migration name=pathentries (at most 512 migrations, each SQL body at most 256 KiB). With no explicit input it reads the database’s migration directory from the wrangler config (--config,--env):migrations_dirdefaults tomigrations,migrations_patterncan select nested layouts, names are paths relative tomigrations_dir, and ordering follows Cloudflare’s numeric-prefix comparator. Already-applied migrations are filtered by the plane’s ledger, so re-running is safe.migrations_tableis not supported.migrations createis local scaffolding: it creates the directory if missing and writes the next numbered.sqlfile.- Deploys never apply migrations automatically. Run
of d1 migrations applyexplicitly. promoteneeds--expected-epochand--expected-lsntogether when either is given.promotionsandstatsare plain reads.
The CLI usage text also lists of d1 time-travel (--at <unix-ms> or --bookmark <bm>, with --dry-run, --generation, --writer-addr, --reason). It is an offline restore tool for the runtime; the OpenFlare console does not expose Time Travel. See Compatibility for the D1 support notes.
Queues
Section titled “Queues”of queues list|create|delete [args]of queues update <name|queue-id> --delivery-delay-seconds <n>of queues send <name|queue-id> [body] [--file <file|->] [--content-type text|json|bytes] [--delay-secs <n>]of queues stats <name|queue-id>send publishes one UTF-8 message (1 byte to 128 KiB); non-UTF-8 input is rejected. delete follows the same purge lifecycle as D1 (blocked while referenced).
Other resources
Section titled “Other resources”These commands exist in the usage text and manage control-plane rows. They follow the same list|create|get|delete pattern, and secret-like values are read from standard input only.
| Command | Manages |
|---|---|
of hyperdrive list|create|get|delete|credential |
Hyperdrive configurations. --origin must be a credential-less postgres://host[:port]/db URL; the password is read from stdin. Delete is refused while a version references the resource. |
of pg list|create|get|update|delete|credential |
Postgres tenants. |
of k2 list|create|get|delete |
K2 event-log streams (--wait-ms supported). |
of vectorize list|create|delete |
Vectorize indexes. |
of flagship list|get|put|delete|publish |
Feature-flag apps. Successful writes are published; publish is the manual recovery step. |
of secrets-store list|put|delete|publish |
Secrets Store secrets (values on stdin). |
of workflows list|upsert|delete|stats|instances |
Workflow declarations and instances. |
of wfop --worker <name> --workflow <name> --op <create|get|action|delete|sendEvent> [--instance <id>] [--action <pause|resume|restart|terminate>] [--params <json>] [--event-type <t>] [--payload <json>] |
Workflow instance operations; waits for the terminal result. |
of durable-objects list|transfer|rename|delete|stats|instances |
Durable Object classes. transfer, rename and delete are explicit lifecycle commands, never replayed by deploy. |
of analytics query <dataset> [--sql <sql> | --file <file|->] [--wait-ms <n>] |
Queries an Analytics Engine dataset (ae is an alias for analytics). |
Durable Object lifecycle examples:
of durable-objects list --worker apiof durable-objects rename --worker api --from OldClass --to NewClassof durable-objects delete --worker api --class OldClassof durable-objects transfer --worker dest --from-script source --from SourceClass --to DestClassRename keeps the same storage identity. Delete returns 404 if the class is absent and 409 while an active version still references it. Transfer fails if the destination class exists, the source class already has transfer lineage, or an active version still references the source class.
Flag details for these families vary; run the command with no arguments to see its usage.
Standalone-mode commands
Section titled “Standalone-mode commands”These commands operate on a local runtime directory (--root <dir>) rather than a control plane. They are not needed for a Docker-based OpenFlare installation, which uses the control-plane commands above.
| Command | Purpose |
|---|---|
of init --root <dir> --cell <id> --tenant <id> [--mode capnp|stub] ... |
Initialize a standalone root. |
of serve --root <dir> [--supervise] ... |
Run the standalone control plane and host. |
of dev [<worker_dir>] [--env <name>] [--listen <addr>] [--no-watch] [--no-color] [--no-logs] [--stub] ... |
Local development loop with file watching. See Local development. |
of deploy --root <dir> ..., of deploy --url <http://host:port> --token-file <path> ... |
Deploy to a standalone root or to a standalone management listener. |
of promote, of rollback --root, of hostnames --root, of secret --root, of status --root, of versions --root, of versions prune|retention|share, of renew, of key, of health, of probe, of logs --root, of doctor, of worker-id, of do-key, of do-snapshot, of do-migrate, of workflows --root |
Standalone operations and diagnostics. |
of logs --root <dir> <worker> supports --follow, --since <dur>, --level debug|info|log|warn|error|platform and --json. of doctor [--root <dir>] [--env <name>] [--json] [--strict] checks the local runtime setup.