Deploy

Deploy your Next.js app to production.

We recommend deploying to Vercel for the best experience with Next.js. The steps below assume you have pushed your project to a Git repository.

Deploy to Vercel

Go to vercel.com, sign in with your Git provider, and import your repository. Vercel will detect Next.js automatically. Leave the default build settings unless you need to change the root directory or output format.

Build settings

If your project uses Prisma (e.g. database or auth modules), add a postinstall script so the Prisma client is generated during deployment:

In package.json, add a postinstall script:

"scripts": {
  "postinstall": "prisma generate",
  ...
}

Vercel runs pnpm install (or npm install) before building, so postinstall will run and generate the Prisma client. You can also run prisma generate as part of your build command if you prefer.

Environment variables

In your Vercel project, open Settings → Environment Variables and add the same variables you use locally (e.g. in .env). Common ones include:

  • DATABASE_URL — for Prisma/database
  • BETTER_AUTH_SECRET, BETTER_AUTH_URL — if you use auth
  • NEXT_PUBLIC_APP_URL — your production URL
  • Any API keys for email, payments, etc.

After saving, redeploy so the new variables are applied.