Ship

Deploy to Vercel

Import the repo, set the environment, point webhooks at the live URL.

01Before you start

You need a hosted Postgres with pgvector, such as Supabase or Neon. Migrate and seed it once from your machine or CI with the production DATABASE_URL:

Terminal
npm run db:migrate
npm run db:seed   # plans from config/plans.ts and the admin user

02Import the project

In Vercel, add a new project from your GitHub repository. The framework preset (Next.js) and build command (next build) are detected; change nothing. Pick a function region close to your database, since every request queries it.

03Environment variables

Add them under Settings → Environment Variables for Production:

.env.local
DATABASE_URL=postgresql://...
DATABASE_POOL_MAX=5
BETTER_AUTH_SECRET=...          # openssl rand -base64 32
BETTER_AUTH_URL=https://app.example.com
NEXT_PUBLIC_APP_URL=https://app.example.com
RESEND_API_KEY=...
EMAIL_FROM=hello@example.com
BILLING_PROVIDER=stripe         # or polar
STRIPE_SECRET_KEY=...
STRIPE_WEBHOOK_SECRET=...

Every serverless instance opens its own pool, so keep DATABASE_POOL_MAX small and use your provider's pooled connection string. On Vercel the AI Gateway authenticates with the project's OIDC token, so AI_GATEWAY_API_KEY is optional. Add the optional groups from Environment variables as you need them.

04Domain and redeploys

Add your domain under Settings → Domains, then make sure BETTER_AUTH_URL and NEXT_PUBLIC_APP_URL use it exactly. NEXT_PUBLIC_* values are baked in at build time, so redeploy after changing one. Sign-in rejects any other origin, so on preview deployments it works only if you give the Preview environment its own matching URL.

05Webhooks and jobs

ServicePoint it at
Stripehttps://app.example.com/api/webhooks/stripe
Polarhttps://app.example.com/api/webhooks/polar
InngestInstall the Inngest Vercel integration (it sets INNGEST_EVENT_KEY and INNGEST_SIGNING_KEY) and sync https://app.example.com/api/inngest

06What already fits Vercel

  • The chat, document and MCP routes set maxDuration = 120 for long model calls.
  • Preview deployments are never indexed by search engines.
  • TEST_MODE is ignored on Vercel production even if set.
  • Sentry uploads source maps at build time when SENTRY_AUTH_TOKEN, SENTRY_ORG and SENTRY_PROJECT are set.
  • Run npm run db:migrate against production before deploying a version with new migrations; the build doesn't migrate.