Don't use .env.local for non-sensitive configuration that should be shared across the team (like a theme color or a public API endpoint). Put those in the standard .env .
There are several reasons why you should consider using .env.local in your projects: .env.local
Add it to your global gitignore as well, to be safe. Don't use
Since .env.local isn't tracked by Git, new developers won't know which variables they need to set. Create a .env.example file with the keys but dummy values (e.g., API_KEY=your_key_here ) and commit that instead. Most modern frameworks load environment files in a
To truly master .env.local , you must understand where it sits in the ecosystem.
Most modern frameworks load environment files in a specific order. Typically, the search order is:
: Use import.meta.env.VITE_API_KEY (note that Vite requires a VITE_ prefix for client-side variables). 3. File Priority (The Hierarchy)