Production Environment Variables

Which environment variables you need in production and how to set them in Vercel.

Last updated:

Where to set production variables

Set environment variables in Vercel from the project dashboard:

  1. Go to your project on vercel.com
  2. Navigate to Settings → Environment Variables
  3. Add each variable with the appropriate environment scope (Production, Preview, Development)

Required for production

All variables listed in the Environment Variables Reference are required for a fully functioning production deployment. The most critical ones:

VariableDescription
NEXT_PUBLIC_APP_URLMust be your actual production domain — affects sitemap, OG images, email links
DATABASE_URLProduction Neon pooled connection (not local!)
DATABASE_URL_UNPOOLEDProduction Neon direct connection — required for migrations
NEON_AUTH_BASE_URLFrom your Neon project's Auth tab — never expose publicly
NEON_AUTH_COOKIE_SECRETSession signing secret — keep server-side only
SANITY_API_TOKENKeep server-side only
OPENAI_API_KEYKeep server-side only
RESEND_API_KEYKeep server-side only

Caution

Never expose NEON_AUTH_COOKIE_SECRET, OPENAI_API_KEY, SANITY_API_TOKEN, or RESEND_API_KEY as NEXT_PUBLIC_* variables. These would be included in the client-side JavaScript bundle and visible to anyone who inspects the page.

Preview vs production environments

Vercel supports three environment scopes: Production, Preview, and Development. Use different database branches or separate credentials for Preview deployments to avoid polluting production data during testing.