Environment variables configuration is one of the first things a developer touches when onboarding to a new codebase. Having clear, well-documented .env.example templates prevents broken builds and security mishaps.
Key Rules for Environment Variables
- Never Commit Secret Credentials: Never check API tokens, DB passwords, or private keys into git repositories.
- Maintain a Clean
.env.exampleTemplate: Keep a dummy template with placeholder values so team members know which variables are required. - Use a Scratchpad for Local Configurations: Use an offline or local sandbox notepad like Scripet to store local connection strings temporarily during setup.
Example .env.example Structure
# Database Configuration
DATABASE_URL="postgresql://user:password@localhost:5432/mydb"
# Authentication & Supabase
NEXT_PUBLIC_SUPABASE_URL="https://your-project.supabase.co"
NEXT_PUBLIC_SUPABASE_ANON_KEY="your-anon-key-here"
# Feature Flags & Analytics
NEXT_PUBLIC_GA_MEASUREMENT_ID="G-XXXXXXXXXX"Need to keep temporary environment templates handy across multiple repositories? Save them in a dedicated pad on Scripet.