Skip to content
PraxisSign in
Knowledge sections

Cloudflare deployment

Deploy the starter to Cloudflare Workers, D1, Queues, and Email Service using Alchemy.

cloudflarealchemydeployment
On this page

Alchemy declares production resources in alchemy.run.ts. Shared queue and rate-limit settings live in infra/bindings.ts; pnpm run infra:wrangler generates local Wrangler configurations from those settings.

Deploy

Configure the deployment credentials and auth environment described in the deployment runbook, then run:

pnpm run deploy

This invokes Alchemy for the prod stage. The stack contains three Workers, a shared D1 database, background queues, and rate-limit bindings. Configured providers add resources such as the email binding and workspace-export bucket. See optional providers.

Pull-request previews

The Preview workflow deploys same-repository pull requests to pr-<number>, with a separate database, queues, and Workers. It migrates and seeds the database and updates a pull-request comment with the URLs. Closing the pull request destroys its stage.

Previews disable optional external providers and set ENVIRONMENT=preview. To manage a preview from a configured deployment shell:

ALCHEMY_STAGE=pr-42 pnpm run deploy:stage
ALCHEMY_STAGE=pr-42 pnpm run db:seed:stage
ALCHEMY_STAGE=pr-42 pnpm run destroy:stage \
  --confirm-target="$CLOUDFLARE_ACCOUNT_ID/pr-42"

Recovery and teardown

Use the recovery runbook for rollback and restore procedures. Check schema and binding compatibility before rolling back Worker code.

pnpm run destroy --confirm-target="$CLOUDFLARE_ACCOUNT_ID/prod" deletes the production stack. It is a teardown command, not a code rollback.