Environment variables are validated at startup using Zod. The application will exit with descriptive errors if any required variables are missing or invalid.
- All environment variables are defined in
apps/api/src/config/env.ts - Zod schema validates type, format, and presence
- Missing required variables cause the process to exit
- Optional variables have documented defaults
- Validated config is the single source of truth
Add the variable to envSchema in apps/api/src/config/env.ts:
NEW_VAR: z.string().min(1, 'NEW_VAR is required'),
npm run generate-env
import { config } from './config/env';
// Use the validated config
const value = config.NEW_VAR;