A bug occurs only when FEATURE_FLAG_NEW_UI=true . You don't want to commit that flag. You add it to .env.local , test the UI, fix the bug, then delete the line from .env.local . No traces left behind.
When your application runs in development mode, the resulting value for API_KEY will be my_debugging_key because it's the value from the highest-priority file.
The most important characteristic of .env.local is that .env.local
: Specific to an environment.
This article dives deep into the .env.local file: what it is, how it differs from other env files, its security implications, and the exact patterns you need to use it effectively in 2025. A bug occurs only when FEATURE_FLAG_NEW_UI=true
DATABASE_URL="postgresql://localhost:5432/dev_b"
# API Keys REACT_APP_API_KEY=your_local_api_key_here NEXT_PUBLIC_API_SECRET=your_local_api_secret_here No traces left behind
: This file is typically added to your .gitignore to prevent sensitive credentials like API keys or local database URLs from being pushed to public repositories.
Only put variables that are truly local to you in .env.local . General development settings can go into .env.development . Troubleshooting: Why is my .env.local not working?