.env.development.local !!exclusive!! -
Variables prefixed with NEXT_PUBLIC_ are exposed to the browser. Variables without the prefix are only available in the server-side environment.
Sharing your team's configuration should be done without sharing secrets. Create a .env.example (or similar) file that lists all the required variable names but contains dummy or placeholder values. This file should be committed to version control. Team members can then copy it to .env.development.local and fill in their own local values. This ensures a smooth onboarding process for new developers. .env.development.local
// Your database connection logic here... export async function getUsers() // Query your database using the secure URL const users = await fetch(DATABASE_URL, ... ).then(res => res.json()); return users; Variables prefixed with NEXT_PUBLIC_ are exposed to the
Because .local files have priority, the settings in .env.development.local override the shared ones. Create a
# Create a file named .env.development.local and add: DATABASE_URL=postgres://user:pass@localhost:5432/mydb STRIPE_SECRET_KEY=pk_test_your_local_key_here
Vite follows a similar pattern using dotenv . It loads .env.[mode].local for the current mode (e.g., development ). However, note that Vite only exposes variables prefixed with VITE_ . The file loading order is identical to CRA.









