---
myst:
  html_meta:
    "description": "How repoplone sees a repository: the repository itself, its packages and their families, the primary package, and the components the packages run in."
    "property=og:description": "How repoplone sees a repository: the repository itself, its packages and their families, the primary package, and the components the packages run in."
    "property=og:title": "The repository model"
    "keywords": "Plone, repoplone, repository.toml, package, component, family, primary package"
---

(repository-model)=

# The repository model

repoplone reads a repository through four ideas: the repository, its packages, their families, and the components the packages run in.
This page explains each of them and why `repository.toml` describes a repository this way.

(repository-model-repository)=

## The repository

The repository is the unit you release and deploy.
It has a name, a version kept in a file such as `version.txt`, and a changelog for the whole project.
When a project builds container images, the repository also names the prefix of those images, and the compose files that run them.

The version of the repository is the version of the project.
Every package released from the repository gets this version, written in the syntax of its ecosystem.
{doc}`versioning` explains why repoplone keeps a single version.

(repository-model-packages)=

## Packages

A package is something repoplone versions, writes a changelog for, and may publish.
It lives in a folder of the repository, given by its `path`.
It has a name, the one it is published under on PyPI or npm.

Every package declares a `type`.
The type tells repoplone two things.
Its first part, `python` or `node`, says how the package is built, versioned, and published.
Its second part, when there is one, says which ecosystem the package builds on: `python-plone` builds on Plone, `node-volto` on Volto, and `node-aurora` on Aurora.
A package without a second part, such as `python` or `node`, builds on no Plone ecosystem.

The ecosystem gives the package a default {term}`base package`: `Products.CMFPlone` for Plone, `@plone/volto` for Volto, and `@plone/aurora` for Aurora.
The base package is the one whose version `repoplone deps` reports and upgrades.

A package with `publish = false` still gets a version and a changelog.
repoplone only skips publishing it to a registry.
Most Plone projects keep the backend and frontend packages of the site itself unpublished, and publish the add-ons they extract from it.

(repository-model-families)=

## Families and the primary package

Packages fall into two {term}`families <family>` by the first part of their type: the `python` family and the `node` family.
Each family is released by its own pipeline step, with its own tools.

In each family, one package is the {term}`primary package`.
When a repository declares no components, the primary package stands for its whole side of the repository.
`deps` tracks its base package.
For the backend, the `pyproject.toml` at the root of the repository, or else in the package folder, pins that base package.
For the frontend, the `mrs.developer.json` at the root of the workspace that holds the package pins it.
The commands that act on "the backend" or "the frontend" act on it.
A package becomes primary with `primary = true`, or by being the first of its family in the file.

This is how repoplone 1 saw every repository: one backend package and one frontend package.
It still describes most Plone projects well.

(repository-model-components)=

## Components

A {term}`component` is an app the packages are developed and installed in: a Plone backend, a Volto site, or an Aurora site.
A component has its own folder, its own lockfile, and its own `make <component>-install` target.
Its base package version is the one the app really runs.

Components exist because packages and apps are not the same thing.
A repository can develop one set of frontend packages in two apps, a Volto site and an Aurora site, each pinning its own base package.
A shared package then belongs to both apps, and an upgrade of Volto must not touch the Aurora app.

A repository that declares no components gets two implicit ones, `backend` and `frontend`, derived from the primary packages.
Nothing changes for such a repository.
A repository that declares components with `[[component]]` tables lists, for each package, the components it belongs to.
{doc}`components` describes the two modes and when to move from one to the other.

(repository-model-specs)=

## Two specifications of `repository.toml`

The first specification of `repository.toml` described one `[backend]` table and one `[frontend]` table.
It could not describe a second Python package, a published add-on next to the site's own package, or two frontends.

The second specification, selected with `spec_version = "2"`, replaces those tables with a list of `[[package]]` tables, each with a type.
It adds the `[[component]]` tables and groups the towncrier options of each package in a `towncrier` table.
A file without `spec_version` is read as specification 1 and keeps working.
`repoplone settings migrate` rewrites it to specification 2 and keeps its comments.

```{seealso}
- {doc}`/reference/repository-toml`, for every table and key.
- {doc}`components`, for repositories with several apps.
- {doc}`/how-to/migrate-from-1x`, to move a repository to specification 2.
```
