Polyrepo

Multi-repo · Un repo para cada servicio

Escrito por Darjus Kazakevic · revisado el

One repository for each service or library, and a version number at every seam.

A polyrepo (also called multi-repo, or one repo for each service) gives each service or library its own repository, CI pipeline and release schedule. It is what most teams get without deciding. Ownership is clear because it is repository membership, and access control is clear for the same reason. Clones are small, and each team can choose its own tools.

The cost sits in one place: a change that spans two repositories is no longer one change. It becomes a pull request, a release, a version bump downstream, more pull requests, and an order someone must manage. Teams usually leave a polyrepo when most features need pull requests in three or four repositories.

En esencia — Give each service or library its own repository, so ownership and releases stay simple, and accept that a cross-repo change becomes versions and merge order.

Cuándo recurrir a él

Recurre a él cuando

  • Services release independently, owned by teams that rarely coordinate
  • Some people must not be able to read some of the code
  • Cross-repo changes are rare, not routine

Reconsidéralo cuando

  • A shared library or design system changes weekly and everyone uses it
  • The same feature often needs pull requests in three repositories
  • You need one version of each dependency across all services

What holds one together

The published seam
Repositories talk through published, versioned artifacts: a package, a container image, an API schema. The published version is the contract, and the only thing consumers may depend on.
Independent release schedule
Each repository ships when its owners decide. There is no shared release train and no waiting for another team's red build.
Repository-level access
Who may write, review and even read is decided by repository membership. It is coarse but clear, and many auditors accept it without discussion.
The cross-repo change
The operation that decides whether this pattern works for you. A change to a library and its consumers takes several steps, and the pain depends on how often it happens.

Reglas de diseño

Split by owner, not by layer
Give each team repositories it fully owns. Separate frontend, backend and schema repositories mean every feature needs three pull requests in a fixed order.
Automate dependency bumps
Use a bot such as Renovate or Dependabot to open bump pull requests in every consumer when a library releases. Then you always know who is still on an old version.
Share CI and conventions from one template
Keep CI workflows, lint config and release scripts in one shared template or reusable workflow. Copied into 30 repositories, they drift, and one change becomes 30 pull requests.

Errores habituales

  • Splitting by layer, so every feature needs the frontend, backend and schema repositories at once.
  • One repository per tiny library, until managing the dependency graph costs more than the code.
  • A consumer left three major versions behind. The “independent schedule” is really unpaid migration work.
  • Using git submodules to fake atomic changes. The problem stays; it is just pinned in place.