nextjs-environment-variables
Installation
SKILL.md
Environment Variables in Next.js
Variable Naming
Next.js has specific rules for environment variable exposure:
- Server-only: Any variable (no prefix required)
- Client-exposed: Must be prefixed with
NEXT_PUBLIC_ - System variables:
NODE_ENV,VERCEL_*are automatically available
File Structure
.env.local # Local overrides (gitignored)
.env.development # Development defaults
.env.production # Production defaults
.env # Defaults (committed)