# Environment variable

> An environment variable is a named setting stored outside the code, on the hosting platform or server, commonly used to hold keys, passwords and addresses that differ between environments.

Source https://rareagentics.com/glossary/environment-variable

## Why does it matter to a buyer?

Keeping secrets in environment variables keeps them out of the code repository. It does not make them private by itself, because some frameworks send chosen variables to the browser. In Next.js, any variable whose name starts with NEXT_PUBLIC_ is built into the code visitors download.

## An example

For example, a payment provider’s secret key belongs in a server-only environment variable, and it becomes public if it is given a name the framework exposes to the browser.

## Related terms

- [Secret key](https://rareagentics.com/glossary/secret-key)
- [Service role key](https://rareagentics.com/glossary/service-role-key)
- [Staging environment](https://rareagentics.com/glossary/staging)
- [Production](https://rareagentics.com/glossary/production)

---

Rare Agentics is a UK software and AI agent engineering firm based in London. Rare Agentics Limited, company number 17494524. Contact hello@rareagentics.com or https://rareagentics.com/contact. Book a call at https://rareagentics.com/book-a-call.
