Monorepo or multi-repo

You are using a monolithic repository (monorepo) when you are storing all of the code of all of your projects and applications in one single source control repository. Opposed to this, you might be using multiple repositories where every application, library, or project is stored in its own repository. Both approaches have their own pros and cons and both approaches are used by companies from small to large.

Possible advantages of a monorepo can include the following:

  • Easier reuse of existing code: If all of the code is in a single repository, it is accessible by and visible to everyone. This means that the chances of reuse are increased.
  • Having all applications in one repository also means that any change affecting more than one application can be made in a single commit, in a single repository. A typical example is an API change.
  • With all of the code being accessible to and maintained by everyone, there is less chance that a developer or team claims a specific repository as its own. This encourages learning from each other.

Possible advantages of multiple repositories include the following:

  • A monorepo can become very, very large, even up to the point that developers checkout or clone only part of the monorepo. This effectively defeats most of the advantages of a monorepo.
  • Having one repository with all of the code encourages tight coupling between components or applications. If you have multiple repositories, you could update an API and release it under a new version and upgrade clients one by one. In a monorepo, you might be tempted to upgrade the API and change all of the consumers in one commit, with all of the risks attached.

Which approach works best for you is influenced not only by the advantages and disadvantages discussed but also by the background and makeup of your team and organization. If you have a single team doing all the development for internal applications, a monorepo might make more sense. If you have multiple teams working on different applications for different clients, multiple repositories make more sense.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.191.162.51