Skip to content

What is an environment variable?

An environment variable is a named setting stored outside your code, such as an API key or a database address. Your app reads it when it runs, so secrets stay out of your shared files.

An example

You save MAPS_KEY=abc123 in your .env file, which Git ignores. Your code asks for MAPS_KEY by name, so the real key never reaches GitHub.

Where you’ll meet it