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:
- Go to your project on vercel.com
- Navigate to Settings → Environment Variables
- 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:
| Variable | Description |
|---|---|
NEXT_PUBLIC_APP_URL | Must be your actual production domain — affects sitemap, OG images, email links |
DATABASE_URL | Production Neon pooled connection (not local!) |
DATABASE_URL_UNPOOLED | Production Neon direct connection — required for migrations |
NEON_AUTH_BASE_URL | From your Neon project's Auth tab — never expose publicly |
NEON_AUTH_COOKIE_SECRET | Session signing secret — keep server-side only |
SANITY_API_TOKEN | Keep server-side only |
OPENAI_API_KEY | Keep server-side only |
RESEND_API_KEY | Keep 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.