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_URL–Public base URL. Defaults to http://localhost:3000.
DB_POSTGRES_PORT–Host 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_SECRET–Enables Google OAuth when both are set.
GITHUB_CLIENT_ID / GITHUB_CLIENT_SECRET–Enables GitHub OAuth when both are set.
OPENAI_API_KEY–Enables OpenAI models.
ANTHROPIC_API_KEY–Enables Anthropic Claude models.
GOOGLE_GENERATIVE_AI_API_KEY–Enables Google Gemini models (free tier available).
STRIPE_SECRET_KEY–Enables billing.
STRIPE_WEBHOOK_SECRET–Verifies incoming Stripe webhooks.
STRIPE_PRICE_ID_PRO / STRIPE_PRICE_ID_BUSINESS–Recurring price ids. Generate with npm run stripe:setup.
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY–Stripe 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_.