nextjsboilerplate Docs
Deployment

Vercel

One-click-ish deploy to Vercel. The boilerplate is configured to work on Vercel with zero config changes.

The short version

npm install -g vercel
vercel

That's it for the first deploy. Vercel detects Next.js, runs npm run build, and ships.

What you have to set up

1. A Postgres database

PGlite is local-only. For production you need a real Postgres. Three good options:

  • Vercel Postgres — same dashboard, automatic env wiring. Easiest.
  • Neon — serverless Postgres, generous free tier, branchable.
  • Supabase — Postgres + auth + storage in one. Use it if you'd otherwise add Supabase later.

Set DATABASE_URL in Vercel project settings → Environment Variables.

2. Run migrations on deploy

Vercel doesn't run a custom step before next build by default. The boilerplate's build script handles this:

"build": "run-s db:migrate build:next"

So npm run build (which Vercel runs) applies all pending migrations against DATABASE_URL before the Next build. No separate "deploy hook" needed.

3. Environment variables

See deployment/env-vars for the full list. Minimum to keep things from no-op'ing:

  • DATABASE_URL
  • NEXTAUTH_SECRET (or BETTER_AUTH_SECRET once migrated)
  • NEXTAUTH_URL=https://your-domain.com

Everything else is optional. Buttons stay visible, providers no-op until keys land.

  • Framework preset: Next.js (auto-detected).
  • Build command: npm run build (default — don't override).
  • Install command: npm install --legacy-peer-deps (override required — see Quickstart for why).
  • Node.js version: 22.x. The boilerplate's engines field requires >=22.14.0 <24.
  • Region: pick the one closest to your Postgres. Cross-region Next-↔-Postgres latency dominates everything else.

What about the cron jobs

The boilerplate declares scheduled jobs in src/jobs/registry.ts:

  • process-scheduled-deletions (0 3 * * * UTC) — RGPD hard-delete.
  • idempotency-cleanup (30 4 * * * UTC) — purge expired idempotency rows.
  • llm.budget-rollover (hourly) — reset daily/monthly LLM spend at boundaries.
  • status.health-probe (every 5 min) — open auto-incidents on probe failure.

Two common paths:

  • Railway worker / Node worker — set JOBS_PROVIDER=railway, configure RAILWAY_WORKER_URL, and let the worker own durable execution/retries.
  • Vercel Cron — point each schedule at /api/cron/[id] with CRON_SECRET; the route invokes the same registry job by id. This is fine for smaller deployments when you accept provider-level retry limitations.

Sentry source maps

If SENTRY_AUTH_TOKEN is set, the build uploads source maps to Sentry. If not, Sentry still works at runtime, you just lose the symbolicated stack traces. Either is fine.

Rollback

vercel rollback against a previous deployment URL. The DB doesn't roll back — migrations are append-only. If you need to undo a migration, write a new migration that does the inverse.

On this page