Lesson 1 of 9 · 24m
Why Monorepos Break at Scale
Understand the coordination, build, ownership, and tooling pressures that appear long before raw repository size becomes the real problem.
The first monorepo failure I was called into was not caused by disk size. The clone was only a few gigabytes. The real failure was that every pull request triggered forty minutes of CI, nobody knew who owned shared packages, and teams started copying code rather than risking a review from strangers. Monorepos fail socially and operationally before they fail mechanically.
The monorepo is a coordination system
A monorepo is not simply "all the code in one repository." It is a decision to make cross-project change cheap and local. That trade pays off when teams need shared libraries, atomic refactors, consistent tooling, and visibility across boundaries. It costs you when unrelated teams are forced through the same bottleneck without enough automation or ownership rules.
The mental model is a graph:
apps/web ---- depends on ----> packages/ui
apps/api ---- depends on ----> packages/auth
packages/ui -> packages/design-tokens
packages/auth -> packages/cryptoEvery edge is leverage and liability. A good edge lets one improvement flow everywhere. A bad edge turns one innocent change into a company-wide build, review, and deployment event.
Scale changes the questions
At ten packages, you can ask people to be careful. At two hundred, care is not a control. You need machine-readable answers:
What changed?
What depends on it?
Who must review it?
Which tests prove it?
Which artifacts can be reused?
Which deployments are allowed afterward?If those answers live in tribal memory, the monorepo is already decaying. The goal of tooling is not fashion; it is to make those questions cheap to answer correctly.
The common failure modes
The same failures appear across organizations:
- CI cartesian explosion: every commit builds every project because nobody trusts dependency inference.
- Ownership dilution: shared packages become everybody's dependency and nobody's product.
- Boundary erosion: application code imports deep internals from another team's package because it is convenient.
- Tooling forks: one team uses npm scripts, another Make, another Bazel, and nobody can compose them.
- Merge queue collapse: main is always red, so teams batch risky changes and make main redder.
Notice that none of these are solved by a bigger server. They are solved by graph discipline, ownership metadata, cache correctness, and CI policy.
Decide what belongs together
A healthy monorepo usually contains code that shares release coordination, architectural primitives, or product velocity. It does not have to contain everything the company writes. Infrastructure, generated SDKs, experimental research, vendor forks, and independently governed services may belong elsewhere.
A useful test is: would these projects benefit from changing atomically in one commit? If yes, colocation has value. If the answer is "only because the Git server is convenient," the repo is becoming a junk drawer.
Field notes
- Repository size is rarely the first scaling pain; CI time, review ambiguity, and dependency confusion show up earlier.
- Atomicity is valuable only when the codebase has tooling that can preserve velocity after atomic changes become large.
- Monorepos amplify both good and bad architecture. They do not create discipline; they expose its absence.
- If teams are afraid to change shared code, the problem is usually missing ownership and tests, not the shared code itself.
Was this lesson helpful?