---
myst:
  html_meta:
    "description": "About components in repoplone: the apps a repository's packages run in, implicit and declared components, and when to declare them."
    "property=og:description": "About components in repoplone: the apps a repository's packages run in, implicit and declared components, and when to declare them."
    "property=og:title": "Components"
    "keywords": "Plone, repoplone, component, Volto, Aurora, frontend, monorepo"
---

(components)=

# Components

A component is an app that a repository's packages are developed and installed in.
This page explains why repoplone separates components from packages, how it derives them when you declare none, and what changes when you declare them.

(components-why)=

## Packages are not apps

A package is what you publish: a Python distribution on PyPI or a Node package on npm.
An app is what you run: a Plone backend with its `pyproject.toml`, or a Volto site with its `package.json`, its `mrs.developer.json`, and its lockfile.

For a long time, a Plone project had one of each per side.
The difference did not matter.
The backend package lived in the backend app.
The frontend package lived in the frontend app.
repoplone 1 treated the two as the same thing.

The difference matters as soon as one set of packages runs in two apps.
Consider a project that keeps its frontend packages under `packages/`, develops them in a Volto site under `volto/`, and starts an Aurora site under `aurora/`.
A package named `videos-core` is installed in both apps.
The Volto app pins Volto in `mrs.developer.json`.
The Aurora app pins `@plone/aurora` in `pnpm-workspace.yaml`.
Upgrading Volto must change the Volto app and nothing else.
A change to `videos-core` must rebuild both apps.

repoplone can only do this if it knows the apps as well as the packages.
Components are how it knows them.

(components-what)=

## What a component carries

A component has a name, a type, and a path.
The name is used for the `make <name>-install` target that installs the app, and for the container image the app becomes.
The type works like a package type: `python-plone`, `node-volto`, or `node-aurora` give the component its base package.
The path is the folder of the app.

From these, repoplone reads the version of the base package the app really uses.
A Plone backend reads it from its `pyproject.toml` or from a version file.
A Volto app reads it from its `mrs.developer.json`.
An Aurora app reads it from its `pnpm-workspace.yaml`, or from its lockfile when the workspace file does not pin it.

Each package lists the components it belongs to.
A component therefore knows its packages, and from their paths, the folders whose changes affect the app.
CI uses those folders to decide which images to rebuild.

(components-implicit)=

## Implicit components

A repository that declares no components gets them anyway.
repoplone derives a `backend` component from the primary Python package and a `frontend` component from the primary Node package.
The `frontend` component sits at the root of the workspace that holds the primary Node package.

These implicit components reproduce what repoplone 1 did.
`deps upgrade backend` and `deps upgrade frontend` keep working, and so do `make backend-install` and `make frontend-install`.
Every repository generated by cookieplone works this way, and most never need more.

(components-declared)=

## Declared components

A repository declares its components with `[[component]]` tables.
Once it does, the components own the base packages.
A `primary` or `base_package` key on a package has no effect.
repoplone warns about it.
A package with no `components` list is released, but no app installs it.

Declare components when the repository has more than one app per side, or when an app's folder does not match what repoplone would derive.
`repoplone settings migrate --components` writes the implicit components of a file out as tables, a starting point to edit.

`settings.backend` and `settings.frontend` keep working in declared mode.
They report the component named `backend` or `frontend`, or else the first Python component and the first Volto component.
Release hooks written for repoplone 1 keep reading them.

```{seealso}
- {doc}`/how-to/declare-several-frontends`, to declare components step by step.
- {doc}`/reference/repository-toml`, for the keys of a `[[component]]` table.
- {doc}`/how-to/use-in-github-actions`, to build one image per component in CI.
```
