# Add components

> Add the repositories and monorepo folders that make up your project, and remove a component from a release.

Add components to tell Patchbay which code makes up your project. A component points to one GitHub repository and one root path in that repository. Every release of the project records one commit for each of its components.

You need the **Contributor** role or higher on the project to add components. See [What each role can do](/projects/access#what-each-role-can-do).

## Choose the shape of a component

A component is either a whole repository or one folder of a repository:

- In a standalone repository, the whole repository is one component and its root path is `/`.
- In a monorepo, one folder of the repository is one component, for example `/apps/checkout-api`. One repository can hold many components, one for each folder.

Patchbay reads only the commits under the root path of a component. In a monorepo, a commit that changes only another folder does not count as a change to this component.

## Where you can add components

The same component editor opens in three places, so you add components the same way in each of them.

| Place | When to use it |
|---|---|
| The **New project** dialog | You create the project. Click **Components** or press `C`. |
| The Genesis page | You set up the first release of the project. |
| An open candidate | You add a component to a project that already has releases. |

When you add a component to Genesis or to a candidate, Patchbay also adds it to the project.

## Add a component

In the component editor, do these steps:

1. In the **Add component…** field, type part of the repository name, and then select the repository in the list.
2. For a standalone repository, select **Use whole repository**. For a monorepo, open the folders and select the folder that holds the component.
3. If you do not want the default branch of the repository, type `@` and select another branch, a tag or a commit.
4. Keep the suggested name or type a new one, and then press `Enter`.

Each name must be unique in the project. The editor shows a message if another component already has the name, or if the name starts or ends with a space.

To add several monorepo folders at once, open the repository and press `Space` on each folder. Then press `Enter` or click **Add selected folders**.

<Callout variant="note" title="Branches and tags move, commits do not">
If you choose a branch or a tag, the component is a tracked ref, and an open candidate follows the ref when it moves. If you choose a commit, the component is a pinned ref and does not change.
</Callout>

The repository list shows the repositories that your workspace can read through GitHub. If a repository is not in the list, see [Connect GitHub](/workspace/github).

## Let a catalog file add components

A repository can declare its components in a `patchbay.yaml` catalog file. When **Catalog sync** is on for the project, Patchbay adds the declared components for you and keeps their descriptions current. See [Describe a repository with patchbay.yaml](/projects/catalog-file).

## See the components of a project

Open the project and click **Components** to see its components grouped by repository. You can switch between **All components**, **With open PRs** and **Needs attention**.

## Remove a component from a release

You can remove a component only from an open candidate, because a promoted release never changes.

1. Open the open candidate that contains the component.
2. Select the component rows that you want to remove.
3. Click **Remove** or press `D`.

If the component was added in this candidate, it leaves the list. Otherwise, the candidate keeps the last commit of the component and shows the component as removed, and the release diff shows the removal. To undo it, select the removed rows and click **Restore**.

A removal changes only the candidate, so the component stays in the project and in earlier releases.

Index of all pages: https://patchbay.unbrikd.com/docs/llms.txt
