Web Dev//environment variable

A variable that lives outside your code — in the server's environment, not in the source files. Accessed via `process.env.NAME` in Node.js.


A variable that lives outside your code — in the server's environment, not in the source files. Accessed via process.env.NAME in Node.js.

In local dev: read from .env.local. Next.js and Vite load them automatically on startup.

In production (Vercel, Cloudflare Pages): configured in the platform dashboard. Same variable names, different values.

Where API keys live. The Supabase URL, the anon key, the service role key, the Google Client Secret — all in .env.local. Never committed to git (.env.local is in .gitignore).

NEXT_PUBLIC_ prefix makes a variable available in the frontend bundle. Without the prefix, it's server-only. This is how you put the publishable key in the browser and keep the secret key on the server.