According to Next.js docs on environment variables:
By default environment variables are only available in the Node.js environment, meaning they won't be exposed to the browser.
In order to expose a variable to the browser you have to prefix the variable with NEXT_PUBLIC_. For example:
NEXT_PUBLIC_ANALYTICS_ID=abcdefghijk
Isn't the whole point to avoid environment variables being exposed? Is it safe to use NEXT_PUBLIC_
... with secrets one doesn't want page visitors to have access to e.g. API Keys?
The docs go on to say that the variables are loaded at build time but does not explain whether or not someone can access them from the browser after the project has been deployed.