The Downside of Monorepos

Brian Winkers
Level Up Coding
Published in
2 min readJul 1, 2022

--

In my previous article, I discussed how moving to a monorepo made sharing code between pieces easier. In this article, I discuss places where using a monorepo hasn’t worked well.

TLDR

A monorepo may be a bad fit if:

  1. It is an open source project.
  2. Using merge-triggered deployments.
  3. Working on different features in multiple parts at the same time.
  4. User access needs are different.
  5. Many end users only need a small part of the code.

We moved out the things that didn’t fit and left the rest in a core repo.

Open Source Projects

It seems onerous to force developers to download any more code than necessary to contribute. It uses extra bandwidth and local storage and that matters to people.

Merge-triggered Deployments

A common paradigm supported by many services is branch-based deployments, merging code into a branch like production triggers a deployment. Netlify and others use this paradigm to make deploying static sites incredibly easy.

The problem comes when using the default deployment processes you end up with each project in the monorepo getting rebuilt on each merge into production, even if there were no changes. This wastes valuable build minutes and increases some chance for errors breaking a service that hadn’t even changed.

Working on Features in Multiple Parts at the Same Time

I found myself making changes in parts that weren’t production ready, just to support current development in another part. Those changes could get lost or worse, committed. It is more productive to choose when I commit changes to each part.

Different User Access Permissions

Many git process don’t support the fine grained permissions on sub-directories. Multiple repos make it easier to define what code each person should be able to access.

End Users Only Need a Small Part of the Code

Most users of TachyonCMS won’t ever need to access the editor code outside of visiting TachyonCMS.org with their browser. Many will want to publish the content they create using the Flow Sites Server to serve semi-static content. That is a much smaller part of the code.

--

--