All docs

Environment variables

All variables are validated at startup by using Zod, so a misconfiguration fails fast with a clear message instead of a runtime crash. Import the typed env object instead of reading process.env directly.

Copy .env.example to .env and fill in the values.

Reference

VariableRequiredDescription
NEXT_PUBLIC_APP_URLPublic base URL. Defaults to http://localhost:3000.
DB_POSTGRES_PORTHost port for the docker-compose database. Defaults to 5432.
DATABASE_URLyesPostgreSQL connection string.
BETTER_AUTH_SECRETyesSecret for signing sessions. Generate with openssl rand -base64 32.
GOOGLE_CLIENT_ID / GOOGLE_CLIENT_SECRETEnables Google OAuth when both are set.
GITHUB_CLIENT_ID / GITHUB_CLIENT_SECRETEnables GitHub OAuth when both are set.
OPENAI_API_KEYEnables OpenAI models.
ANTHROPIC_API_KEYEnables Anthropic Claude models.
GOOGLE_GENERATIVE_AI_API_KEYEnables Google Gemini models (free tier available).
STRIPE_SECRET_KEYEnables billing.
STRIPE_WEBHOOK_SECRETVerifies incoming Stripe webhooks.
STRIPE_PRICE_ID_PRO / STRIPE_PRICE_ID_BUSINESSRecurring price ids. Generate with npm run stripe:setup.
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEYStripe publishable key (client).

"Required" variables must be present for the app to boot. Optional variables light up their feature when set — the template runs with just a database and one AI key.

Notes

  • Empty strings ("") are treated as unset.
  • Set SKIP_ENV_VALIDATION=1 to bypass validation (used in the Docker build step and CI lint).
  • Client-exposed variables must be prefixed with NEXT_PUBLIC_.