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

  • 1
    Never commit .env files
  • 2
    Use strong, unique values
  • 3
    Rotate secrets regularly
  • 4
    Limit access to production values

Organization

  • 1
    Use clear, descriptive names
  • 2
    Group related variables
  • 3
    Document all variables
  • 4
    Validate 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