Monorepo vs polyrepo: how should you organize your code?
A monorepo keeps many projects or services in a single repository. A polyrepo setup gives each project its own repository. Large companies have famously chosen both.
Monorepo advantages
- Atomic changes across multiple projects in one commit
- Shared tooling, linting and CI configuration
- Easier code reuse and refactoring across boundaries
- One place to search
Monorepo challenges
- Needs tooling for builds and tests that only run what changed (Nx, Turborepo, Bazel, Pants and similar)
- Repository size and clone times can grow
- Access control per project is harder
Polyrepo advantages
- Clear ownership and independent release cycles
- Smaller, faster repositories
- Teams can choose their own tools
Polyrepo challenges
- Cross-repo changes require coordinated pull requests and version bumps
- Dependency drift between services
- Duplicated CI configuration and boilerplate
Small teams often find a monorepo simpler because coordination overhead is low. Organizations with very independent teams sometimes prefer polyrepos to reduce coupling.
What does your organization use, and would you switch? What tooling made your monorepo manageable, if you have one?
Comments · 3
It's an organizational question dressed as a technical one. Monorepos favor shared ownership, while polyrepos favor team autonomy.
Consistency of tooling and shared design components are an argument for one repo, I imagine.
What do you do about build times in a monorepo as it grows? I'm guessing tooling that only builds what changed.