# Environment variables

> The variables your packages read, one encrypted value per scope, linked to the packages that use them and pushed to Vercel; your agents read the names, never the values.

Source: https://docs.architure.dev/docs/environment-variables

Environment variables keep the configuration your apps read (`DATABASE_URL`, `STRIPE_SECRET_KEY`, `RESEND_API_KEY`) in one place. Each variable has a name, a description, and a value for **All** environments or its own value for **Production**, **Preview** and **Development**. A variable is available to all packages, or linked to the [packages](/docs/repositories) that read it (`apps/web` of one repository, `packages/email` of another).

Your agents read the names and descriptions their package uses, never the values: they write `process.env.STRIPE_SECRET_KEY` instead of guessing a name, and ask you for a value when they need one. [Deployments](/docs/deployments) pushes the values each package reads to its Vercel projects.

## Names and descriptions

A name uses upper-case letters, digits and underscores, and does not start with a digit (`DATABASE_URL`, `NEXT_PUBLIC_APP_URL`), up to 255 characters. The description is rich text: what the variable is for and where to get a value, for people and agents. Agents read it as Markdown.

A variable can also name the [tech stack](/docs/tech-stack) item it belongs to (**Tech stack item** in its dialog), so an agent reading "Stripe" in the tech stack also learns its keys.

## Values and scopes

A variable holds one value per scope, and at least one:

| Scope | Used |
| --- | --- |
| All | In every environment that has no value of its own |
| Production | In production |
| Preview | In preview deployments |
| Development | In development |

An environment's own value overrides **All**: a variable with an **All** value and a **Production** value uses the second in production and the first everywhere else. The three environments are Vercel's targets; a sync pushes an **All** value to each of the three (see [Deployments](/docs/deployments)).

Values are encrypted on Architure's servers (AES-256-GCM) before they are stored. They are decrypted only on the server: when you reveal or copy one, and when [Deployments](/docs/deployments) compares or pushes it. A value holds up to 32 KB of text.

## The Environment variables page

**Environment variables**, in the organization's sidebar, lists one row per variable: its **Name** (with the first line of its description), its **Packages** (**All packages**, the packages' names, or **No package**) and a cell per scope: **All**, **Production**, **Preview**, **Development**.

A value shows as dots. The eye reveals it, and hides it again; the copy button copies it without showing it. A scope without its own value shows **Uses All**, or a dash when there is no **All** value either. With no variable yet, the page reads "No variables yet".

## Creating and editing a variable

**New variable** opens the dialog:

- **Name** and **Tech stack item** (or **None**).
- **Values**: one field per scope. Fill in at least one. "An environment's own value overrides All."
- **Packages**: **Available to all packages** (the default), or turn it off and check the packages that read the variable, grouped by repository.
- **Description**.

**Create variable** saves it. **Edit**, in the row's menu, opens the same dialog, but it never loads the stored values: a scope with a value reads **Unchanged** and keeps its value until you type a new one, and one without a value reads **Not set**. **Clear** beside a stored value removes it on save (the field then reads "Cleared on save"; **Keep** undoes it). **Save** writes the changes.

**Delete**, in the row's menu, asks for a confirmation, then deletes every value of the variable for good, in every scope.

## Two variables with the same name

Several variables may share a name, as long as a package never gets two values for the same name and scope from the same level. The two levels are "linked to the package" and "available to all packages". So you can have:

- a `DATABASE_URL` available to all packages with an **All** value, and another `DATABASE_URL` linked to `apps/api` with its own **Production** value;
- two `DATABASE_URL` variables available to all packages, one with a **Preview** value and one with a **Production** value.

A save that would give a package a second value for the same name and scope at the same level (two variables available to all packages, or two linked to one package, setting the same scope) is refused with a "clash" error that names the other variable. Change the scope, the packages, or the other variable.

## Precedence

For one package, Architure resolves each name scope by scope:

1. A variable linked to the package wins over one available to all packages with the same name.
2. At that level, the environment's own value wins over **All**.

So a `DATABASE_URL` available to all packages and a `DATABASE_URL` linked to `apps/api` with only a **Production** value give `apps/api` its own value in production and the shared one elsewhere. The page filtered to a package, the agents and the Vercel sync all use this one rule (see [Concepts](/docs/concepts#scopes-and-precedence)).

## The Package filter

Once the organization has imported a [repository](/docs/repositories), **Package** above the table filters the page to one package (or **All variables**), grouped by repository. The page then shows only the variables that package reads (the ones linked to it and the ones available to all packages), resolved exactly as its agents get them from `list_environment_variables`, with a line saying "What `apps/web` (`acme/shop`) reads".

Each cell then says whether the package reads that value:

- **Used**: the package gets this value for this scope ("This package reads this value.").
- **Overridden**: another variable of the same name supplies this scope; hover to see whether it is one linked to the package or one available to all packages.

A scope that falls back to **All** is marked the same way. The filtered page has its own address (`?package=` and the package's id), so you can share it; **All variables** shows every variable again. A package with no variable reads "No variable for" and its name. A repository's page links each variable a package uses to this filtered view.

## Synced to Vercel

Once a variable has been pushed to a Vercel project, or brought in from one, its name shows **Synced to Vercel**, with the project names on hover. When one of its values changed since the last sync, it shows **Out of sync** instead: run **Sync** on [Deployments](/docs/deployments) to push it. Nothing is pushed when you save a variable.

## What agents see

The MCP tool `list_environment_variables` never returns a value:

- With `repository` (`owner/name`) and the folder the agent works in (`path`), it returns the package it answered for and the names that package reads, each with its description and the scopes that hold a value, each scope with its source: `package` (linked to it, which wins) or `allPackages`.
- Without a repository, it returns every variable of the organization: its name, its description and the scopes that hold a value (`all`, `production`, `preview`, `development`).

`list_tech_stack` lists, for each technology, the names of the variables linked to it. Both API key permissions (read and write) and OAuth connections read the names; no agent can create, change or reveal a variable. See [MCP tools](/docs/mcp-tools).

## Who can do what

Owners, admins and members create, edit, reveal, copy and delete variables. Viewers have no access: the page is not in their sidebar, and a repository's page shows them no variables. Like every write, saving and deleting need an active trial or subscription (see [Billing and trial](/docs/billing)); after an unpaid trial the variables stay readable, and the page says "This organization is read-only until it has a plan."
