FREEFirst project with us? Your landing page design is on the house.See the offer

Glossary · Astro and headless

What is Environment variables?

By Abdul QuadirUpdated Nov 2026
Environment variablesnoun · Astro and headless

Environment variables are settings stored outside your code, such as API keys and URLs. They keep secrets out of your repository and let each environment use its own values.

Environment variables are settings stored outside your code, such as API keys and URLs. They keep secrets out of your repository and let each environment use its own values.

Environment variables, explained

Code often needs a secret, such as a CMS token. Writing it in the code would put it in Git history, where it can be copied. An environment variable keeps it in the host's settings instead.

They also let the same code behave differently per environment. A preview build can point at a test dataset, while production points at the live one.

Be careful what reaches the browser. In Astro, variables starting with PUBLIC_ are included in code the browser can read, and Next.js does the same with NEXT_PUBLIC_. Secrets must never use those prefixes.

Locally, these values usually live in a .env file that Git ignores. If a key does leak, rotate it straight away, because deleting it from the code does not remove it from history.

In our work

How Kookies uses it

We keep API keys in environment variables on the host, and check that only values safe for the public reach browser code.

FAQs

Environment variables
questions.

Abdul Quadir
Still have a question?Ask us directly. We reply within a day.
Book a callPick a timehello@kookies.io

A local file holding environment variables for development. It should be left out of Git.

They are safer than code, but only if they stay on the server. Anything sent to the browser is public.

Revoke it and create a new one straight away, then check where it was used.

Your turn

Let's kook
what you krave.

Hi Kookies, I need a built on . I'd love to launch . Reach me at
or book a callSent. We reply within one working day.