Next.js loads environment variables from .env files, with an important security rule: variables are server-only by default, and only those prefixed with NEXT_PUBLIC_ are exposed to the browser.
The files
.env # loaded in all environments
.env.local # local overrides — GITIGNORED (put secrets here)
.env.development # only in `next dev`
.env.production # only in production builds
