What is a monorepo? What are its advantages and disadvantages?

Asked

Viewed 4,946 times

15

What is a monorepo (mono repository) and what problems it seeks to solve?

  • What are the advantages?
  • What are the disadvantages?
  • 5

    Better than https://answall.com/q/440839/101.

3 answers

15


Monorepo as its name says, would be a single repository to maintain the code of several projects.

In a work environment, where there are several separate projects that are integrated, it is common for developers to need to create mocks, or to upload several projects to perform some simple activities.

For example: You have a project that is responsible for completing Login. This project is in 10 other projects. A vulnerability was found in this Login project. With a Monorepo the adjustment would be much simpler.

Perks:

  • With the use of Monorepo, the various projects will be in a single git, this will help in code reuse.
  • With Monorepo it’s easier to build all the projects that have changed.
  • It’s simpler to maintain a unique visual style for the various projects, since it’s possible to have a common project to handle css and images.
  • The integration of a new member into the team tends to be something faster and smoother, as it will not need to download and configure several separate projects.

Disadvantages:

  • Create the culture of using a single repository.
  • Based on the growth of the project, it becomes more costly to carry out the clone.
  • There is no way to create security between projects, all developers can work on all projects.
  • Depending on the Git system, it’s good to evaluate the maximum file history size allowed, to ensure that using a Monorepo is not expensive.

For more information, I recommend the following readings:

https://github.com/joelparkerhenderson/monorepo_vs_polyrepo

https://nx.dev/angular/getting-started/why-nx

https://cacm.acm.org/magazines/2016/7/204032-why-google-stores-billions-of-lines-of-code-in-a-single-repository/fulltext

2

I think that using a monorepo has more disadvantages than the advantages as mentioned in this article: https://www.atlassian.com/git/tutorials/monorepos

Disadvantages which in my opinion cancel out the advantages, considering large monorepo:

  • Performance problems in the case of large monorepos
  • Commit history (timeline) makes it difficult to understand what’s been changed and what affects what, while also affecting troubleshooting
  • Greater difficulty controlling version individually (by projects).
  • Increased difficulty in deploying and merging between Branches from other environments, resulting in incomplete code sending to Production or Homologation Branches
  • In a way the use of tag doesn’t make much sense except for all projects at the same time
  • Lack of access control by project
  • Longer time to download the project

-2

Each project can have its own versioning, its own deploy. When I think of monorepo, it makes sense to me when both projects share the same code, libraries and so on.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.