Docs Center

Deployment

Self-host on Cloudflare Workers: environment, config and release.

Prerequisites

  • Node.js 20+ and npm.
  • A Cloudflare account with Workers and D1.
  • wrangler CLI installed and authenticated.
  • A domain for access (optional).

Deploy to Cloudflare Workers

The Next.js app is adapted by OpenNext and deployed to Workers.

  • Install dependencies and verify a local build.
  • Generate the Workers bundle with OpenNext.
  • Publish with wrangler.
  • Bind a custom domain after the first deploy.
npx --yes opennextjs-cloudflare build
npx --yes wrangler deploy

Environment variables

Set the following variables in the wrangler config or dashboard.

VariableDescription
JWT_SECRETSigning secret for auth tokens — use a strong random value.
ADMIN_EMAILBootstrap admin email.
ADMIN_PASSWORDBootstrap admin password; change it after first login.
LLM_BASE_URLDefault LLM endpoint (optional).
DBD1 database binding name.

Init & migrate

On first deploy, create the D1 database and run the schema.

wrangler d1 create ezp-db
wrangler d1 execute ezp-db --file=./schema.sql
npx --yes wrangler deploy
Tip: after schema changes, re-run the schema to migrate; back up production data first.

Release flow

  • Run type-check and unit tests locally.
  • Build and preview locally to confirm pages render.
  • Deploy to Cloudflare and verify in the browser.
Verify critical paths in a preview environment before release.