Skip to content
EANVI

What are environment variables?

Environment variables are key-value pairs provided by the operating system or runtime so an application can change behavior without rebuilding source code.

A simple mental model

Your code asks for DATABASE_URL. The environment supplies it. Change the environment, and the same binary talks to a different database. That separation is why twelve-factor apps prefer env-based config.

const databaseUrl = process.env.DATABASE_URL;
if (!databaseUrl) {
  throw new Error('DATABASE_URL is required');
}

How .env files fit in

A .env file is a convenient way to load variables into a local process. Frameworks and libraries such as dotenv popularized the format. The file is not magic — it is just a transport for environment variables.

Secrets vs non-secrets

Some environment variables are public (e.g. NEXT_PUBLIC_SITE_URL). Others are secrets. Both may use the same mechanism; only secrets need encrypted storage and tighter access control.

Related resources

Try EANVI

Create a workspace, import a .env, and pull secrets from the CLI.