CodeZettaInterview Hub

Next.js · Deployment · Mid-Level · Debugging

How do env vars work between build and runtime in Next?

Short Interview Answer

NEXT_PUBLIC_* inlined at build; server env read at runtime; secrets must not use NEXT_PUBLIC_.

Detailed Explanation

Misusing public prefix leaks secrets. Rebuild when public env changes. Use platform secret stores.

Did you know this answer?