Environment Variables
Learn how to securely manage environment variables for different deployment environments on Vercel.
Setup Process
Access Project Settings
1
Navigate to your project in the Vercel dashboard and click on 'Settings'
Environment Variables
2
Select 'Environment Variables' from the left sidebar
Add Variables
3
Click 'Add New' and enter your key-value pairs
Configure Environments
4
Select which environments (Production/Preview/Development) should use each variable
Required Variables
Essential
Core Variables
Core Variables
Essential environment variables for the application:
TYPESCRIPT
Environment Configuration
Production
Live environment settings
- Use production API keys
- Live database credentials
- Production URLs
Preview
PR and branch deployments
- Test API credentials
- Staging database
- Test webhooks
Best Practices
Security
- 1Never commit .env files
- 2Use strong, unique values
- 3Rotate secrets regularly
- 4Limit access to production values
Organization
- 1Use clear, descriptive names
- 2Group related variables
- 3Document all variables
- 4Validate required variables
Local Development
Local Configuration
For local development, create a .env.local
file in your project root:
Local Environment
Example .env.local file:
TYPESCRIPT
Never commit your .env.local file to version control. Add it to your .gitignore file.