Next.js environment files
Next.js loads .env.local for secrets and .env for defaults. Only variables prefixed with NEXT_PUBLIC_ are exposed to the browser, so never put secrets behind that prefix.
Generate NEXTAUTH_SECRET
The template creates a random 48-byte Base64 NEXTAUTH_SECRET for Auth.js / NextAuth. Use the Regenerate button for a new value and copy the .env.example for your repo.
Frequently asked questions
Which file should I use, .env or .env.local?
Use .env.local for real secrets (it is ignored by Git by default) and .env for non-sensitive defaults.
How long should NEXTAUTH_SECRET be?
At least 32 random bytes. The generated Base64 value meets that.