Skip to main content

Glossary

What Is an Environment Variable

An environment variable is a configuration value stored outside your code that changes depending on where the application runs. Plain-English definition for business owners.

Definition

An environment variable is a named value that is set outside of your application's code and used to configure how the application behaves in a particular environment. Common examples include database connection details, API keys for third-party services, and settings that differ between development, staging, and production, such as whether to send real emails or capture them for testing. Environment variables are stored in a configuration file (often called .env) or set directly on the server, and the application reads them at runtime. Crucially, they are never committed to the code repository. For related terms, see the rest of our glossary.

Why It Matters

Environment variables keep sensitive information such as passwords, API keys and secret tokens out of your codebase. If these values were hard-coded into the source files, anyone with access to the repository would also have access to your production credentials, and changing a value would require a code change and redeployment. Environment variables separate configuration from code, which means the same application code can run in different environments (development, staging, production) simply by changing the variables. They are also a fundamental security practice. Leaked source code on its own is embarrassing but survivable. Leaked source code with embedded database passwords and an API key is a breach.

Example

Your web application connects to a payment provider using an API key. In the development environment, the environment variable holds a test key that processes fake transactions. In production, it holds the live key that processes real payments. When a new developer joins and sets up the project locally, they configure their own environment variables pointing to the test key. They can develop and test payment flows without any risk of charging real customers or needing access to production credentials. Getting these values set correctly across servers is part of our infrastructure support work.

Portrait of Alexander De Sousa, founder of Digital Royalty
Founder-led
“I’ve put everything I know into how this company works — the standards, the method, the care on every project. It runs through the whole team, and I hold us all to it.”

Alexander De Sousa · Founder LinkedIn

Featured on BBC Radio Solent

Get started

Tell us what you need

A few quick questions, then a straight answer from a real person — usually within a few hours.

Tell us what you're working on

Whether it's a new site, a platform, or a process that shouldn't be manual any more — we'll tell you honestly if we can help.