Deploy
layer deploy deploys directly to Cloudflare from the local machine. It uses local Cloudflare credentials and local deployment state.
Commands
Section titled “Commands”layer loginlayer deploy [project] [options]layer deploy status [project] [options]layer deploy history [project] [options]layer destroy [project] [options]Deploy Flow
Section titled “Deploy Flow”Local deploy:
Login -> Compile -> Plan -> Apply -> Record stateWhen apply completes successfully, the CLI prints a short completion block with the deployed backend URL:
✓ Done Your backend is live.URL https://api.example.com/v1Deployment dep_20260525_...Options
Section titled “Options”Deploy options:
| Option | Value | Notes |
|---|---|---|
--env | <name> | Local state scope name for isolated deploy records. |
--account-id | <id> | Cloudflare account id. |
--zone-id | <id> | Cloudflare zone id for the custom domain. |
--r2-token | <token> | Cloudflare token for Storage R2 signed URL token maintenance. |
--app-name | <name> | Override generated Worker app name. |
--dry-run | Preview deploy without applying Cloudflare changes. | |
--force | Continue after non-create provider failures. | |
-h, --help | Show help. |
Status And History
Section titled “Status And History”Destroy
Section titled “Destroy”layer destroy removes tracked resources for one local environment.
By default, it deletes stateless resources and retires persistent resources.
Retired resources stay in deployment state for later manual cleanup.
The command asks for confirmation with y/N before it applies the destroy
plan. Use --auto-approve or -auto-approve in automation.
Use --dry-run to print the destroy plan without prompts, provider calls, or
state changes.
Destroy also requires a second confirmation. Type the project name at the
prompt to continue. In CI=1, pass --i-waive-second-confirmation because the
command cannot prompt for the project name.
Pass
--i-know-i-am-deleting-persistent-resources-and-this-is-irreversible to delete
persistent resources during destroy. This action removes provider resources and
cannot be undone.
| Option | Value | Notes |
|---|---|---|
--env | <name> | Local state scope name. Defaults to default. |
--account-id | <id> | Cloudflare account id. |
--zone-id | <id> | Cloudflare zone id for route resources. |
--dry-run | Preview destroy without applying changes. | |
--auto-approve | Skip the confirmation prompt for automation. | |
-auto-approve | Skip the confirmation prompt for automation. | |
--i-know-i-am-deleting-persistent-resources-and-this-is-irreversible | Delete persistent resources instead of retiring them. | |
--i-waive-second-confirmation | Waive project-name confirmation in CI=1. | |
-h, --help | Show help. |