Environment variables
How env is validated and what each variable does.
Source of truth
Runtime validation lives in src/platform/env (@t3-oss/env-nextjs + Zod). If a required server variable is missing or invalid, the app fails fast.
Bootstrap
cp .env.example .env.localFill values from Neon, Upstash, Resend, and OAuth consoles. For Vercel, mirror the same names in Project → Settings → Environment Variables (or vercel env pull .env.local).
Variable map
| Variable | Layer | Purpose |
|---|---|---|
NEXT_PUBLIC_APP_URL | client | Canonical site URL (auth redirects, emails) |
DATABASE_URL | server | Neon pooled connection for runtime |
DATABASE_URL_UNPOOLED | optional | Direct URL for drizzle-kit DDL |
AUTH_SECRET | server | Better Auth secret (≥ 64 chars) |
GITHUB_CLIENT_ID / SECRET | server | GitHub OAuth |
GOOGLE_CLIENT_ID / SECRET | server | Google OAuth |
KV_REST_API_URL / TOKEN | server | Upstash Redis |
RESEND_API_KEY | server | Resend API (re_…) |
RESEND_EMAIL_FROM | server | Verified sender address |
See also Reference → Environment.