Deployment

Deployment

Check mode and target in nextdevtpl.generated.json before preparing an environment. Full mode supports server, docker, vercel, and cloudflare. Demo mode supports only server and has no database, business secrets, or API health endpoint.

Release checks for full projects

Install dependencies and run the project gates:

pnpm install --frozen-lockfile
pnpm lint
pnpm typecheck
pnpm test:run
pnpm build

Use the production domain for the site URL and for OAuth, payment webhooks, Inngest, storage CORS, and other provider dashboards. Configure only capabilities retained in the generated record and .env.example.

Server

A full project requires Node.js 24 and pnpm 10. When a database is selected, prepare a PostgreSQL connection and apply migrations before production traffic.

  1. Prepare .env.production in a protected directory.
  2. For the first deployment, generate and review the migration with pnpm db:generate:init, then run pnpm db:migrate through the release process.
  3. Load production variables and run pnpm deploy:server:build.
  4. Upload .release/ and adjust deploy/server/nextdevtpl.service for the real user and path.
  5. Terminate TLS with Nginx, Caddy, or another proxy and forward the original protocol and host headers.

Skip database steps when the project has no database selection. See deploy/server/README.md for file-level instructions.

Docker Compose

The Docker target is for full mode. Compose provides deployment configuration for the database, one-shot migration, and app; use the generated .env.example and Compose file as the source of truth. The database uses a named volume.

docker compose --env-file .env.production up -d --build

Replace retained values such as POSTGRES_PASSWORD, BETTER_AUTH_SECRET, and site URLs. Back up the named volume or external database before upgrades. See deploy/docker/README.md.

Vercel

The Vercel target is for full mode.

  1. Import the project with Node.js 24 and pnpm.
  2. Configure variables retained in the generated .env.example for each environment.
  3. When a database is selected, run pnpm db:migrate locally or in a controlled single-instance release job.
  4. Deploy and configure the selected OAuth, payment, and Inngest callbacks.
  5. Run the health check against the production domain.

Do not put migrations in Vercel's buildCommand; concurrent builds can execute them more than once. Available service combinations depend on the generated selection.

Cloudflare Workers

The Cloudflare target is for full mode and uses OpenNext. The generator writes the Worker entry, open-next.config.ts, wrangler.jsonc, and cf:* scripts, then adds R2, AI, Email, Workflow, and Rate Limiting bindings when selected.

  1. Create or bind the required resources and check Worker and bucket settings in wrangler.jsonc.
  2. Add the database URL, auth secrets, and selected service credentials with wrangler secret put or Cloudflare's secret manager.
  3. Generate Worker types and build:
pnpm cf:check
pnpm cf:types
pnpm cf:build
pnpm exec wrangler deploy --dry-run --minify
  1. Deploy:
pnpm cf:deploy

The current full-mode Cloudflare database path uses a PostgreSQL-compatible service such as Neon HTTP; the generator does not yet offer D1 as a database option. The older 3.x wording about D1 records that release's support boundary. Other 4.x deployment targets provide the capabilities in their own generated configuration. OpenNext builds on Windows can encounter symlink restrictions; use WSL or Linux CI when that happens.

Demo projects

Demo projects support only server and need no business environment variables, database migrations, or provider resources. Build and start the Next.js server normally:

pnpm install --frozen-lockfile
pnpm build
pnpm start

Demo output has no /api/health route. Verify it by opening the pages and exercising local sample actions. Business changes exist only in the current tab's memory and reset on refresh.

Production checks for full projects

Full projects expose /api/health:

pnpm deploy:check -- https://your-domain.example/api/health

After it returns HTTP 200 with status: healthy, verify login, database access, and each selected payment, mail, storage, AI, jobs, and rate-limit flow. The health response never returns secret values.

On this page