Skip to content

Deploy

layer deploy deploys directly to Cloudflare from the local machine. It uses local Cloudflare credentials and local deployment state.

Terminal window
layer login
layer deploy [project] [options]
layer deploy status [project] [options]
layer deploy history [project] [options]
layer destroy [project] [options]

Local deploy:

Terminal window
Login -> Compile -> Plan -> Apply -> Record state

When apply completes successfully, the CLI prints a short completion block with the deployed backend URL:

Terminal window
✓ Done Your backend is live.
URL https://api.example.com/v1
Deployment dep_20260525_...

Deploy options:

OptionValueNotes
--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-runPreview deploy without applying Cloudflare changes.
--forceContinue after non-create provider failures.
-h, --helpShow help.

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.

OptionValueNotes
--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-runPreview destroy without applying changes.
--auto-approveSkip the confirmation prompt for automation.
-auto-approveSkip the confirmation prompt for automation.
--i-know-i-am-deleting-persistent-resources-and-this-is-irreversibleDelete persistent resources instead of retiring them.
--i-waive-second-confirmationWaive project-name confirmation in CI=1.
-h, --helpShow help.