Environment Variables
Configure your application using environment variables for different deployment stages.
Env Variables
What Are Environment Variables?
Environment variables are key-value pairs that store configuration data outside of your codebase. They allow you to customize your application's behavior without modifying source code.
Local Development
# .env.dev PORT=3000 DEBUG=true API_URL=https://api.dev.local
Use .env.dev for local development settings.
Production
# .env.prod PORT=80 DEBUG=false API_URL=https://api.prod.local
Use .env.prod for production settings.
Configuration Best Practices
Secure Storage
Never commit sensitive environment variables to version control.
Environment Separation
Maintain separate configuration files for different environments.
CI/CD Integration
Inject environment variables through your CI/CD pipeline securely.
Usage Examples
const apiKey = process.env.VITE_API_KEY; console.log(`Using API key: ${apiKey}`);View Configuration
curl -X GET 'https://api.dev.local/data' \ -H 'Authorization: Bearer $API_TOKEN' \ -H 'Content-Type: application/json'Configuration Examples