Environment variables in Netlify UI

Hi all,

Here is my site: https://main--superlative-arithmetic-f35229.netlify.app/

I have recently built a static site using nextJS and deployed to Netlify via GitHub repo, which pulls some information from the Notion API. I have set the environment variables using the Netlify UI, such as API keys and database IDs.

As I am a beginner, is this a safe way to keep the API keys secret? Or will the keys and info be exposed to the browser? Are these variables able to be seen by users on the browser? As it is a serverless site I understand the using .env wouldn’t be the best approach as the keys have to be visible in the GitHub repo to be able to run at build time via Netlify.

Any help or advice would be much appreciated.

Any environment variables that you use in the client-side JavaScript are insecure. The server-side ones are fine. Since you know your code better than we do, it would be useful for you to verify whether you’re leaking the code to client-side JavaScript.