Homeglossary

What Is an Environment Variable?

An environment variable is a named value stored outside your app's code that the app reads while it runs. It's the standard way to keep configuration and secrets, like API keys or database URLs, out of the code itself.

Knowing this now means your first build starts on the right footing.

How environment variables work

Instead of writing a value like an API key directly into your code, you store it as a name and value pair in the environment the app runs in. The code refers to it by name, and the actual value is supplied at runtime. This keeps sensitive values out of your codebase, and lets the same code use different values in different places, for example a test value while you build and a real one once the app is live.

Examples

When your app connects to a payment service, the secret key lives in an environment variable rather than in the code, so it isn't exposed if the code is shared. When you build on Emergent and add a feature that needs an outside service, the credential for it is stored this way, kept separate from the app you're building.

Frequently Asked Questions

Your Questions, Answered

This will automatically populate, don't change

Don't change this element unless you know what you are doing

Start Building
on Emergent today
Start Building