Monorepositories

One of the controversies—probably not ascending to the level of holy war—in our field is whether we should keep our version controlled source code in several repositories or a single monorepository. The correct answer is, of course, “it depends”. Still, there’s a widely held belief that monorepositories are not a good thing.

Except that Google, Facebook, and Twitter all use them and love ’em or hate ’em they indisputably have a lot of talented engineers who we can presume know what they’re doing. Dan Luu is another developer who believes that monorepositories can be a good thing.

Luu got tired of explaining why he believes this so he wrote it down in a blog post. In it, he lists the advantages of using a monorepository instead of several repos. These advantages are:

Simplified Organization
That’s pretty much obvious. With per project repos or some similar arrangement it’s hard to know how to structure things. With a monorepository, everything lives in a single repository and many of the structuring problems disappear.
Simplified Dependencies
With separate repositories, it’s hard to keep the versions of separate components in sync. With a monorepository, everything has the same version.
Simplified Tooling
With multiple repositories, build and other tools have to understand the relationship between the code in the individual repositories. That problem is easier in a monorepository.
Cross Project Changes
When there are interproject dependencies, changes can get complicated regardless of whether there is one or many repositories but with a monorepository it’s much easier to coordinate a big change that involves multiple projects.

Luu has much greater detail for each of these so if the matter interests you, be sure to take a look at his post.

This entry was posted in General and tagged . Bookmark the permalink.