Explore monorepo versus multiple repos

Completed

A repository is where your work history is stored, usually in a .git folder.

How should you organize your code repositories? Development teams want to keep different parts of their software separate and organized. Over time, code repositories can become messy with unrelated code and files.

When organizing your repositories, there are two main approaches: using one repository (Monorepo) or multiple repositories.

  • Monorepo - All source code is kept in one repository. It's easy to give all team members access to everything at once. Clone it, and you have everything.
  • Multiple repositories - Each project or component gets its own separate repository.

The main difference between these approaches is about how teams can work together most effectively. With multiple repositories, each subteam can work in their own repository. This lets them use the libraries, tools, and workflows that work best for them.

The downside is that using anything from another repository is like using a third-party library, even if someone on your team wrote it.

If you find a bug in a library from another repository, you need to:

  1. Fix it in that repository
  2. Publish a new version
  3. Return to your repository and update your code

This can be slow, especially if the bug involves different code bases, libraries, tools, or workflows. You might need to ask the owner of that system for help and wait for their response.

With a monorepo, managing complex dependency relationships can be harder, but the benefits of independent teams aren't as important. Some teams might work efficiently, but others might not. Having all your work in one repository lets you focus on managing just one place.

In a monorepo, you avoid the hassle of making changes in other repositories or waiting for other teams to make changes for you. Anyone can change anything they need.

If you find a bug in a library, fixing it's as easy as fixing a bug in your own code.

Note

In Azure DevOps, it's common to use a separate repository for each solution within a project.