Monorepo vs. Polyrepo

Monorepo: all your code in one repository. Polyrepo: code split across many repositories.

Both work. Both have failure modes. The choice has more impact than expected.

The trade-offs

Monorepo

Pros:

Cons:

Polyrepo

Pros:

Cons:

When monorepo wins

Famous examples: Google, Meta, Microsoft Office, Twitter (now X) — all run massive monorepos.

When polyrepo wins

Most open-source projects are polyrepo (each library has its own repo). Most startups start polyrepo.

The tooling problem

Monorepos at scale need specific tools:

Build systems

Make/Maven/Gradle work but slow on large monorepos. Tools designed for scale:

These tools rebuild only what changed; cache across users; scale to thousands of modules.

Git scaling

For very large repos:

Microsoft's Scalar and Git's own improvements have made large monorepos more practical.

CI

Running all tests on every change doesn't scale. Need:

Bazel and similar tools provide this; CI systems integrate.

Code ownership

CODEOWNERS files (GitHub native) or similar. Different teams own different paths; PRs route to right reviewers.

Hybrid approaches

Small set of large repos

Not one monorepo, not many small ones. Maybe 5-10 repos for major systems. Each is a "small monorepo."

Multi-repo with shared libraries

Polyrepo with conventions: shared lib repos, service repos, deployment repos. Independent but coordinated.

Repo per language

Each language gets its own repo. Polyglot orgs sometimes do this.

"Modern monorepo"

JS-heavy projects use Nx or Turborepo as a "monorepo lite" — works at most company scales without going to Bazel.

The cultural side

Monorepo vs. polyrepo isn't just technical. It shapes how teams work:

Monorepo culture

Polyrepo culture

Neither is universally better. Match the structure to how you want teams to operate.

Migration

Switching is hard:

Polyrepo → Monorepo

Combine repos one at a time. Use git subtree or git filter-repo to preserve history. Re-tool CI.

Monorepo → Polyrepo

Extract services. Each becomes its own repo with relevant history.

Both migrations take months. Don't switch lightly.

Common failure patterns

A reasonable starter position

For new orgs:

Re-evaluate as you grow. The right answer at 10 engineers may not be right at 100.

Further Reading