---
myst:
  html_meta:
    "description": "Declare a backend, a Volto app, and an Aurora app as components in repository.toml, with packages shared between the two frontends."
    "property=og:description": "Declare a backend, a Volto app, and an Aurora app as components in repository.toml, with packages shared between the two frontends."
    "property=og:title": "Declare several frontends"
    "keywords": "Plone, repoplone, component, Volto, Aurora, frontend, repository.toml"
---

(how-to-declare-several-frontends)=

# Declare several frontends

This guide shows you how to declare the apps of a repository with `[[component]]` tables.
The example repository develops its frontend packages in a Volto app and in an Aurora app.

The repository has this layout.

```text
backend/                  Plone backend app
volto/                    Volto app, with mrs.developer.json
aurora/                   Aurora app, with pnpm-workspace.yaml
packages/acme-videos/     Python package, installed in the backend
packages/volto-videos/    Volto add-on, installed in the Volto app
packages/aurora-videos/   Aurora add-on, installed in the Aurora app
packages/videos-core/     Node package, installed in both frontend apps
```

```{important}
Components need specification 2 of `repository.toml`.
If the file has no `spec_version = "2"` line, follow {doc}`migrate-from-1x` first.
```

(how-to-declare-several-frontends-start)=

## Start from the derived components

Let repoplone write the components it derives today.

```shell
uvx repoplone settings migrate --components
```

The command adds a `backend` and a `frontend` component, and a `components` list to every package.
It keeps the comments of the file.
Run it with `--dry-run` first to see the result without writing it.

(how-to-declare-several-frontends-components)=

## Declare one component per app

Edit the `[[component]]` tables so that there is one per app.
Name each component after the `make` target that installs it: `volto` for `make volto-install`.

```toml
[[component]]
name = "backend"
type = "python-plone"
path = "backend"

[[component]]
name = "volto"
type = "node-volto"
path = "volto"
changelog_package = "@acme/volto-videos"

[[component]]
name = "aurora"
type = "node-aurora"
path = "aurora"
changelog_package = "@acme/aurora-videos"
```

The `type` gives each component its base package: `Products.CMFPlone`, `@plone/volto`, and `@plone/aurora`.
Set `base_package` only when the app builds on something else, such as a Volto distribution.

`changelog_package` names the package whose changelog repoplone copies to the app's own `CHANGELOG.md` at release time.
Leave it out when the app keeps no changelog of its own.

(how-to-declare-several-frontends-packages)=

## List the components of each package

Give every package the list of apps that install it.
The shared package lists both frontend apps.

```toml
[[package]]
type = "node"
name = "@acme/videos-core"
path = "packages/videos-core"
changelog = "packages/videos-core/CHANGELOG.md"
components = ["volto", "aurora"]
```

Remove `primary` and `base_package` from the packages.
With components declared, they have no effect, and repoplone warns about them.

A package without `components` is still versioned and released.
No app installs it, and no component reports it.

(how-to-declare-several-frontends-verify)=

## Check the result

List the base packages of each app.

```shell
uvx repoplone deps info
```

The table has one row per component: `Backend`, `Volto`, and `Aurora`, with their base packages.
Compare the versions the apps pin with the latest releases.

```shell
uvx repoplone deps check
```

Check the folders that trigger each app in CI.

```shell
uvx repoplone settings github-outputs
```

The `paths-filter` block lists `packages/videos-core/**` under both `volto` and `aurora`.

(how-to-declare-several-frontends-makefile)=

## Match the Makefile targets

`repoplone deps sync` and `repoplone deps upgrade` install an app with `make <component>-install` after they change its pins.
Check that the `Makefile` at the root of the repository has one such target per component.

```make
.PHONY: volto-install
volto-install: ## Install the Volto app
	$(MAKE) -C volto install

.PHONY: aurora-install
aurora-install: ## Install the Aurora app
	$(MAKE) -C aurora install
```

```{seealso}
- {doc}`/explanation/components`, for why components exist.
- {doc}`/reference/repository-toml`, for every key of `[[component]]` and `[[package]]`.
- {doc}`upgrade-plone-or-volto`, to upgrade one app at a time.
```
