# Deployments

> Connect Vercel, match each Vercel project to the package it deploys, and push the environment variables that package reads, after reviewing every change.

Source: https://docs.architure.dev/docs/deployments

Deployments connects your Vercel teams to Architure. Each Vercel project is matched to the [package](/docs/repositories) it deploys, and **Sync** pushes the [environment variables](/docs/environment-variables) that package reads to the project's Production, Preview and Development environments. Nothing is written to Vercel before you review the changes and confirm them.

Architure only pushes. A project's variables are read once, when you bring them in after importing the project; from then on values flow from Architure to Vercel, never back. Deployments shows no deployment status or logs.

## Connecting Vercel

On **Deployments**, in the organization's sidebar, choose **Connect Vercel**. Architure connects through its integration on Vercel: Vercel asks which team to install it on and which of the team's projects it may reach (all of them, or the ones you pick), then brings you back to Deployments with the import dialog open. The integration reads the team's projects and reads and writes their environment variables.

Once a team is connected, the page lists the connected teams, with **Connect another team** beside them (also in the import dialog). To let Architure reach more projects of a team, give the integration access to them in Vercel.

The team's token is stored encrypted and never shown. Vercel ties the connection to the person who connected the team: if that person leaves the Vercel team, Vercel disables it, and the team's projects cannot be synced. They show this message: "The person who connected this team left it. A team owner can transfer the integration in Vercel within 30 days, or connect the team again." Connect a team from an account that stays.

Removing the Architure integration in Vercel deletes the variables Architure created there; the page says so beside the connected teams. To stop syncing a project and keep its variables in Vercel, remove the project from Deployments instead.

## Importing projects

**Import projects** lists, for each connected team, the projects the integration reaches, with a search. Each project shows its GitHub repository and root directory, and the package it matches ("Package `web` (acme/shop)") or why it matches none ("No package:" and the reason below). Projects already imported are checked, locked and marked **Imported**. Pick some and choose **Import**: at most 50 at once.

## How projects match packages

A Vercel project matches a package by its Git repository and its root directory:

- the repository is the [imported repository](/docs/repositories) whose GitHub repository is the one connected to the Vercel project;
- the package is that repository's package whose folder is the project's root directory (the repository's root, `.`, when the project has none).

A project that matches no package has **No package**, with the reason:

- "No Git repository is linked to this project in Vercel."
- "Its repository is not on GitHub." (GitLab, Bitbucket and other providers do not match.)
- "Its GitHub repository is not imported in Repositories." Import it on Repositories.
- "Its root directory is not one of the repository's packages." Check the root directory in Vercel, or refresh the repository.
- "A member cleared its package."
- "Its repository and root directory match a package now." The repository or the package was imported after the project: choose **Use** and the package's name to match it.

A project without a package is never synced. A package may have several Vercel projects (a web app deployed twice, for example); a project has at most one package.

## The Deployments page

Each imported project shows:

- **Project**: its name, its team and its root directory.
- **Package**: the package it deploys, or **No package** and why.
- **Variables**: how many of its Vercel variables Architure manages ("3 managed").
- **Last sync**: when it was last synced, or "Never".

Owners and admins change a project's package in the **Package** select: a package of the organization, grouped by repository, or **No package** to clear it.

The menu at the end of a row offers **Sync** (for a project with a package), **Import variables…** (owners and admins, for a project with a package) and **Remove** (owners and admins). **Remove** asks for a confirmation: Architure stops syncing the project and forgets which of its variables it manages, and its variables stay in Vercel as they are.

## Bringing in a project's variables

Right after an import, Architure opens **Import variables of** for each new project that has a package, one after the other. It lists the variables the project holds in Vercel, by name, each with the environments (Production, Preview, Development) that have it. An environment marked with a lock holds a Secret: Vercel never returns its value. Every name that can come in is ticked; untick the ones to leave out and choose **Import** (at most 200 at once), or **Not now** to skip. **Import variables…** in the project's menu opens the dialog again later.

- A name becomes an environment variable linked to the project's package, or joins the variable of that name already linked to it ("Joins the variable of this name linked to the package.").
- The values Vercel returned become the variable's values. When Production, Preview and Development hold the same value, it becomes one **All** value ("The same value for every target: stored as All.").
- Each environment whose value was read is now managed by Architure: the next sync updates that Vercel variable instead of creating a second one.
- An environment holding a Secret comes in without a value and stays not managed until you set the value in Architure; a name whose every value is a Secret cannot be imported (create it on the Environment variables page).
- A name already managed in every environment is not offered again ("Already managed by Architure."), and a name that is not upper-case letters, digits and underscores cannot come in: rename it in Vercel first.
- Variables limited to a Git branch or a custom environment are not imported.

Changes made later in Vercel are never read back: Architure's value wins on the next sync.

## Sync

**Sync** at the top of the page reviews every imported project; **Sync** in a project's menu reviews only that one. The **Sync to Vercel** dialog computes, for each project and each environment, the values its package reads, exactly as the Environment variables page filtered to that package (and as its agents get them): a variable linked to the package before one available to all packages, then the environment's own value, else **All**. An **All** value goes to each of the three environments. Architure then compares those values with the project's Vercel variables and lists one row per name, grouped by environment:

- **Add**: Architure gives a value and the project has no variable for that name and environment (also when the variable was deleted in Vercel since the last sync).
- **Change**: the value changed in Architure since the last sync, or someone edited the variable in Vercel since then (the row is marked **Edited in Vercel**). Architure's value replaces it.
- **Remove**: a variable Architure manages that the package no longer reads (its variable was deleted, unlinked from the package, or lost that environment's value).
- **Take over**: Architure gives a value for a name and environment that the project already holds in a variable Architure does not manage ("Vercel already holds this key; Take over overwrites it."). Taking it over overwrites the Vercel value and manages the variable from then on.
- **Not managed**: a variable that exists only in Vercel, or is limited to a Git branch ("Preview value for the branch" and its name) or to a custom environment (listed under **Custom environments**). It is listed without a checkbox and never touched.

Adds and changes start ticked; removes and take-overs start unticked, so each one is your own decision. A project already in step reads "Up to date: nothing to write."

A project shows a badge instead of tickable rows when it cannot be synced:

- **No package**: it matches no package.
- **Blocked**: two variables of one level give its package the same name for one environment ("Two variables of one level set the same key for a target: fix them before syncing this project."). Fix them on the Environment variables page.
- **Unreachable**: Vercel refused, with its reason: for example the project is no longer one the integration may reach, or the person who connected the team left it.

**Review and sync** shows the confirmation: "Write 5 changes to 2 projects in Vercel?", with the count of adds, changes, removes and take-overs, what removes and take-overs do, and that deployments pick the new values up on their next build. **Write 5 changes** writes them; **Back** returns to the review. At most 2,000 rows go in one sync.

**Sync finished** then says what each project got: "Synced: 3 changes written.", "Nothing to write.", or "Stopped after 2 changes:" with Vercel's error. Projects are written one at a time, and a project stops at its first refused write, keeping what was written before it. A row whose situation changed between the review and the confirmation (someone else synced, or a value changed) is skipped, and the outcome says how many rows were skipped: sync again to see them.

Architure writes every value as a **Secret** (sensitive) variable, in Production, Preview and Development alike, so Vercel never shows it again. Values are compared through a fingerprint that never leaves Architure's servers, and the dialog shows names, never a value.

## What Architure never does in Vercel

- It never reads values back from Vercel after a project's variables were brought in.
- It never changes or deletes a variable it did not create or take over.
- It never removes a variable unless you tick its **Remove** row, and never takes one over unless you tick its **Take over** row.
- It never writes before you confirm, and never syncs on its own when a value is saved.
- It never touches Shared Environment Variables, Git branch values or custom environments.

## On the Environment variables page

A variable pushed to or brought in from at least one project shows **Synced to Vercel**, with the project names on hover, or **Out of sync** when one of its values changed since the last sync. Run **Sync** to push it.

## Who can do what

Owners and admins connect Vercel teams, import projects and their variables, change a project's package and remove a project. Members see the projects and run **Sync**; the page tells them "Your role can read the projects and sync them, not connect Vercel or change the projects." Viewers do not see the page, since the review shows which values changed, and agents have no access to it. Like every write, connecting, importing and syncing need an active trial or subscription (see [Billing and trial](/docs/billing)).
