Lesson 9 of 9 · 28m
When a Monorepo Hurts — and What to Do About It
Recognize the organizational, security, compliance, and velocity cases where splitting or avoiding a monorepo is the better engineering decision.
The senior answer is not "monorepos are good" or "monorepos are bad." It is that repository topology is an organizational control. Sometimes it increases leverage. Sometimes it creates a single blast radius for access control, CI failure, release coordination, and organizational politics. Knowing when the shape hurts is part of using it well.
The pain signals that matter
Do not split because someone dislikes the repository aesthetically. Split when structural pain persists after reasonable tooling investment:
CI remains slow because hidden coupling defeats affected builds.
Ownership cannot be enforced because unrelated teams share critical paths.
Security boundaries require different read access or audit controls.
Release cadence is forced into lockstep despite independent products.
The merge queue serializes teams with no actual dependency.
Repository operations harm specific workflows even after sparse/shallow tuning.The key phrase is after reasonable tooling investment. A bad day with Git is not proof. A year of failed boundary enforcement is evidence.
Security and compliance can be decisive
A monorepo often gives broad read access by default. That is a problem when the repository contains export-controlled crypto, customer-specific implementations, incident response tooling, acquisition code, or sensitive security detections. Path-level write restrictions are common; robust path-level read isolation is much harder.
If two groups must not see each other's code, separate repositories are usually the honest control. Bolting secrecy onto a monorepo with submodules, sparse checkout folklore, or generated partial mirrors creates operational theater.
Independently governed systems resist colocation
Open-source projects with external contributors, vendor forks, firmware with separate certification, acquired products, and systems under different release authorities often fit poorly. Atomic commits lose value when one side cannot merge, release, or disclose on the same cadence.
A service can consume shared packages without sharing a repository. Publication workflows, API contracts, and versioning become more explicit — sometimes that friction is exactly what governance requires.
The hybrid future is normal
Most large organizations end up hybrid:
product monorepo apps + shared product libraries
platform monorepo internal developer tooling and infrastructure
separate repos vendor forks, sensitive security, regulated artifacts
registry/contracts published packages, OpenAPI, protobuf, eventsThis is not failure. It is federation around real coupling. The mistake is pretending repository count is a purity metric. The real question is where atomic change, visibility, and governance boundaries belong.
Splitting is a migration, not a deletion
If you decide to split, treat it like a production migration:
1. Freeze dependency direction and document current consumers.
2. Choose what history must be preserved.
3. Extract package publication and CI first.
4. Move leaf consumers before shared foundations when possible.
5. Keep compatibility shims temporary and dated.
6. Archive or lock old paths only after mirrors and references stabilize.git filter-repo can preserve selected history, but history surgery has cost. Sometimes a clean cut with a reference commit hash is operationally safer than a perfect archaeology project.
Sometimes the monorepo is the correct answer
Do not let this lesson become an excuse for fragmentation. If teams constantly need coordinated API/client/schema changes, shared design systems, and broad refactoring, a monorepo can outperform a constellation of inconsistently versioned repositories. Splitting because people dislike learning the workspace tools often recreates the same coupling with worse versioning and delayed integration.
Field notes
- Repository topology follows power and accountability as much as code structure. Ignore the org chart at your peril.
- If access control is the reason to split, validate it with security and compliance before investing in extraction tooling.
- Keep contract artifacts versioned regardless of topology; a monorepo does not eliminate compatibility work.
- Re-evaluate the boundary annually. The correct topology at twenty engineers is not necessarily correct at two hundred.
Was this lesson helpful?