Environment Variable Naming Convention¶
Note
This is an example document that outlines a proposed naming convention for environment variables.
Core Principles¶
- Use UPPERCASE for all variable names
- Separate words with underscores
- Use prefixes to group related variables
- Avoid special characters except underscores
- Be descriptive yet concise
General Structure¶
[PREFIX]_[PROJECT]_[FEATURE]_[SETTING]
PREFIX: Environment, component, or service (e.g., APP, DB, API)PROJECT: (Optional) For multiple instances of a serviceFEATURE: Specific module or functionalitySETTING: Actual configuration detail
Common Prefixes¶
APP_: General application settingsDB_: Database configurationsAPI_: API-related settingsAUTH_: Authentication parametersAWS_: Amazon Web ServicesSUPABASE_: Supabase projectsSTRIPE_: Payment processingGCP_: Google Cloud PlatformOPENAI_: OpenAITWILIO_: TwilioSENDGRID_: SendGridSENTRY_: SentryDOPPLER_: Doppler
Multiple Project Handling¶
For services with multiple projects (e.g., Supabase):
- Use consistent naming across projects
- Include a project identifier after the service prefix
- Choose identifiers based on project function
Example:
SUPABASE_FLEET_URLSUPABASE_TOOLS_API_KEYSUPABASE_ADS_JWT_SECRET
Best Practices¶
- Avoid sensitive information in variable names
- Use TRUE/FALSE for boolean flags
- Use numeric suffixes for lists (e.g.,
ALLOWED_HOSTS_1) - Maintain a
.env.examplefile - Consult service documentation for recommended names
- Use environment-specific files (
.env.development,.env.production)
Security and Secret Management¶
- Use Doppler for managing all environment variables and secrets
- Never commit actual secrets or API keys to version control
- Configure Doppler CLI for local development and CI/CD pipelines
- Utilize Doppler's environment-specific configurations (e.g., development, staging, production)
- Implement Doppler's access controls and audit logging for enhanced security
Debugging¶
- Implement a
PRINT_ENV_VARSflag for conditional logging - Add startup checks for required variables
Remember to update documentation when modifying environment variables.