Skip to content

Instantly share code, notes, and snippets.

@iagocavalcante
Created October 8, 2025 23:31
Show Gist options
  • Select an option

  • Save iagocavalcante/7d10ff00ec0acd913a6c7af345b4c2da to your computer and use it in GitHub Desktop.

Select an option

Save iagocavalcante/7d10ff00ec0acd913a6c7af345b4c2da to your computer and use it in GitHub Desktop.
Environment Variables Template - Comprehensive .env template for various tech stacks
# ========================================
# Environment Variables Template
# ========================================
# Copy this file to your project as .env
# and fill in your actual values
#
# NEVER commit .env files to version control!
# Add .env to your .gitignore
# ========================================
# Application Configuration
# ========================================
NODE_ENV=development
PORT=3000
APP_NAME=my-app
APP_URL=http://localhost:3000
# ========================================
# Database Configuration
# ========================================
# PostgreSQL
DATABASE_URL=postgresql://user:password@localhost:5432/database_name
DB_HOST=localhost
DB_PORT=5432
DB_NAME=database_name
DB_USER=postgres
DB_PASSWORD=your_password_here
# MySQL
# DATABASE_URL=mysql://user:password@localhost:3306/database_name
# MongoDB
# MONGODB_URI=mongodb://localhost:27017/database_name
# ========================================
# Redis Configuration
# ========================================
REDIS_URL=redis://localhost:6379
REDIS_HOST=localhost
REDIS_PORT=6379
# REDIS_PASSWORD=your_redis_password
# ========================================
# Authentication & Security
# ========================================
# JWT
JWT_SECRET=your_jwt_secret_key_here_min_32_chars
JWT_EXPIRY=7d
JWT_REFRESH_SECRET=your_jwt_refresh_secret_here
JWT_REFRESH_EXPIRY=30d
# Session
SESSION_SECRET=your_session_secret_here
# Encryption
ENCRYPTION_KEY=your_encryption_key_here
# ========================================
# External Services
# ========================================
# AWS
AWS_REGION=us-east-1
AWS_ACCESS_KEY_ID=your_aws_access_key
AWS_SECRET_ACCESS_KEY=your_aws_secret_key
AWS_S3_BUCKET=your-bucket-name
# Cloudflare
# CLOUDFLARE_API_TOKEN=your_cloudflare_token
# CLOUDFLARE_ZONE_ID=your_zone_id
# SendGrid / Email
# SENDGRID_API_KEY=your_sendgrid_api_key
# SMTP_HOST=smtp.gmail.com
# SMTP_PORT=587
# [email protected]
# SMTP_PASSWORD=your_app_password
# Stripe
# STRIPE_SECRET_KEY=sk_test_your_stripe_secret
# STRIPE_PUBLIC_KEY=pk_test_your_stripe_public
# STRIPE_WEBHOOK_SECRET=whsec_your_webhook_secret
# Twilio
# TWILIO_ACCOUNT_SID=your_account_sid
# TWILIO_AUTH_TOKEN=your_auth_token
# TWILIO_PHONE_NUMBER=+1234567890
# ========================================
# OAuth / Social Login
# ========================================
# Google
# GOOGLE_CLIENT_ID=your_google_client_id
# GOOGLE_CLIENT_SECRET=your_google_client_secret
# GOOGLE_CALLBACK_URL=http://localhost:3000/auth/google/callback
# GitHub
# GITHUB_CLIENT_ID=your_github_client_id
# GITHUB_CLIENT_SECRET=your_github_client_secret
# GITHUB_CALLBACK_URL=http://localhost:3000/auth/github/callback
# Facebook
# FACEBOOK_APP_ID=your_facebook_app_id
# FACEBOOK_APP_SECRET=your_facebook_app_secret
# ========================================
# API Keys & Third Party Services
# ========================================
# OpenAI
# OPENAI_API_KEY=sk-your_openai_api_key
# Anthropic (Claude)
# ANTHROPIC_API_KEY=sk-ant-your_anthropic_key
# Analytics
# GOOGLE_ANALYTICS_ID=G-XXXXXXXXXX
# MIXPANEL_TOKEN=your_mixpanel_token
# Monitoring & Error Tracking
# SENTRY_DSN=your_sentry_dsn
# SENTRY_ENVIRONMENT=development
# ========================================
# Feature Flags
# ========================================
ENABLE_FEATURE_X=false
ENABLE_DEBUG_LOGGING=true
ENABLE_CORS=true
# ========================================
# URLs & Endpoints
# ========================================
API_URL=http://localhost:3000/api
FRONTEND_URL=http://localhost:3001
WEBHOOK_URL=http://localhost:3000/webhooks
# ========================================
# Rate Limiting
# ========================================
RATE_LIMIT_WINDOW=15m
RATE_LIMIT_MAX_REQUESTS=100
# ========================================
# File Upload
# ========================================
MAX_FILE_SIZE=10485760
UPLOAD_DIR=./uploads
# ========================================
# Logging
# ========================================
LOG_LEVEL=debug
LOG_FORMAT=json
# ========================================
# Mobile / React Native
# ========================================
# Expo
# EXPO_PUBLIC_API_URL=http://localhost:3000/api
# EXPO_PUBLIC_CLERK_PUBLISHABLE_KEY=pk_test_xxx
# ========================================
# Elixir / Phoenix Specific
# ========================================
# SECRET_KEY_BASE=your_secret_key_base_min_64_chars
# PHX_HOST=localhost
# PHX_PORT=4000
# ========================================
# Python / Django Specific
# ========================================
# SECRET_KEY=your_django_secret_key
# DEBUG=True
# ALLOWED_HOSTS=localhost,127.0.0.1
# ========================================
# Ruby / Rails Specific
# ========================================
# RAILS_ENV=development
# RAILS_MASTER_KEY=your_rails_master_key
# ========================================
# Notes
# ========================================
# • Generate secure secrets: openssl rand -base64 32
# • Never commit this file with real values
# • Use .env.example for sharing structure
# • Consider using 1Password CLI for secrets management:
# op inject -i .env.template -o .env
# • For production, use environment variable management:
# - Heroku Config Vars
# - AWS Secrets Manager
# - Vercel Environment Variables
# - Railway Variables
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment