Environment Variables Best Practices
Manage environment variables securely across different environments
.antigravity
# Environment Variables Guide
## Setup
- Use .env files
- Never commit secrets
- Use .env.example template
- Document all variables
## Next.js Environment Variables
- Use NEXT_PUBLIC_ prefix
- Server vs client variables
- Load from .env.local
- Use environment-specific files
## Security
- Rotate secrets regularly
- Use secret managers
- Validate required variables
- Don't log sensitive data
## Best Practices
- Type environment variables
- Validate on startup
- Use different values per environment
- Document usage