Dev tools

Monorepo vs Polyrepo: Which Fits Your Team?

Monorepo vs polyrepo compared: code sharing, atomic changes, CI, versioning, ownership, tooling (Nx, Turborepo, Bazel) and how to choose for your team.

By OmniAI Editorial · Nov 23, 2026 · 11 min read

In monorepo vs polyrepo, the question is simple: do you keep all your projects in one version-control repository or give each project its own? A monorepo holds many services, libraries and apps side by side, sharing one history and one set of tooling. A polyrepo setup (also called multi-repo) splits them into separate repositories, each with its own history, versioning and release process.

Neither is better in general. A monorepo makes sharing code and changing many projects at once easy, at the cost of needing smarter build and CI tooling as it grows. Polyrepos give teams independence and simple, small repositories, at the cost of coordinating changes across many repos and managing versions of shared libraries. Google famously keeps most of its code in one giant repository; many other successful companies run hundreds of separate repos. This guide explains the trade-offs, what tooling each needs, how CI changes, a worked example and how to choose.

Monorepo vs Polyrepo at a Glance

MonorepoPolyrepo
StructureMany projects in one repositoryOne repository per project or service
Code sharingImport directly from shared foldersPublish shared code as versioned packages
Cross-project changesOne atomic commit and pull requestCoordinated pull requests across repos, in order
VersioningOften everything at the latest version ("one version")Each repo versions and releases independently
CINeeds "affected only" builds and caching to stay fastSimple per-repo pipelines
OwnershipShared repo; ownership by folder (CODEOWNERS)Clear per-repo ownership and permissions
DiscoverabilityAll code searchable in one placeNeeds cross-repo search tools
Tooling needsWorkspace and build tools (Nx, Turborepo, Bazel and others)Package registry, dependency update automation
Scaling painRepo size, clone time, CI timeDependency drift, coordination overhead

What Is a Monorepo?

What is a monorepo? It's a single repository containing multiple distinct projects that could, in principle, live on their own. It's not the same as a monolith: a monorepo can hold dozens of independently deployed microservices. The "mono" refers to the repository, not the architecture.

A typical JavaScript or TypeScript monorepo looks like this:

repo/
  apps/
    web/          # customer-facing site
    admin/        # internal dashboard
    api/          # backend service
  packages/
    ui/           # shared design system
    auth/         # shared auth helpers
    config/       # shared lint and TypeScript settings
  package.json    # workspace definition
  turbo.json      # or nx.json: build pipeline and caching

The biggest public example is Google. In a 2016 paper in Communications of the ACM, Rachel Potvin and Josh Levenberg described Google's repository as holding about 86 TB of data, including roughly two billion lines of code in nine million unique source files as of January 2015, used by about 95% of its software developers. Google built its own version-control system, Piper, to handle that scale.

Monorepo vs Multirepo: The Trade-offs

Left: one box with three apps linked to an orange shared block; right: three separate boxes with dashed links to a shared database
One repository with shared packages versus separate repositories linked through published versions.

The monorepo vs multi repo choice comes down to where you want the friction.

Changing shared code

In a monorepo, changing a shared library and every project that uses it happens in one pull request: one review, one CI run, one atomic merge. In a polyrepo setup, you change the library, publish a new version, then update each consuming repo, often over days or weeks, with some projects lagging behind.

Versions and dependencies

Monorepos often follow a single-version policy: all projects use the same version of each third-party dependency. That prevents conflicts but forces everyone to upgrade together. Polyrepos let each project upgrade on its own schedule, which is flexible but leads to version drift, where different services run very different versions of the same library and security patches spread slowly.

Independence and ownership

Polyrepos make boundaries obvious: separate permissions, separate pipelines, separate release cadences. In a monorepo, teams share one repository, so ownership is enforced by folder with tools such as a CODEOWNERS file, and a broken shared build can block everyone until it's fixed.

Discoverability and consistency

In a monorepo, anyone can search all the code, see who calls a function and fix a bug everywhere at once. Shared lint, formatting and build settings keep projects consistent. With polyrepos, every repo tends to drift into its own conventions unless a platform team maintains templates.

Monorepo Pros and Cons

Here are the monorepo vs polyrepo pros and cons side by side.

Monorepo prosMonorepo cons
Atomic changes across projectsCI must be smart, or every change rebuilds everything
Easy code sharing without publishing packagesRepository can grow large; clones and checkouts get slower
One set of tooling, lint and build rulesOne broken main branch affects everyone
Whole-codebase search and refactoringPermissions are coarser than separate repos
Single source of truth for dependency versionsUpgrades must happen everywhere at once
Polyrepo prosPolyrepo cons
Small, fast repositoriesCross-repo changes need coordination and version bumps
Clear ownership and fine-grained accessVersion drift and duplicated code
Independent pipelines and release cadenceHarder to discover code across repos
Simple tooling per repoInconsistent conventions without a platform team
Failures stay containedIntegration problems surface late

Security and Dependencies

Repository layout changes how you manage risk:

  • Dependency inventory. A monorepo with a single-version policy has one list of third-party packages to scan and patch. With polyrepos, the same library may appear in dozens of repositories at different versions, each needing its own update.
  • Patching speed. Fixing a vulnerable dependency in a monorepo is one change, tested against everything at once. In polyrepos, the fix rolls out repo by repo, and the slowest team sets the exposure window.
  • Access control. Polyrepos make it simple to restrict who can read sensitive code. Monorepos rely on branch protection and review rules by folder, and everyone with access can usually read everything.
  • Secrets. A secret committed anywhere in a monorepo is visible to everyone who can clone it, so secret scanning on every commit matters even more.

Day-to-Day Developer Experience

TaskMonorepoPolyrepo
New developer setupOne clone, one install, one set of scriptsClone each repo you need; setups may differ
Running the whole system locallyOften one command from the rootCoordinate versions and start each service separately
Finding how something is usedSearch the repositorySearch across repositories with extra tooling
Reviewing a cross-cutting changeOne pull request shows the full pictureSeveral pull requests reviewed separately
Release notes and versioningNeeds tooling to version packages separately, if requiredNatural per repository

Monorepo Tools

Monorepo tools exist mainly to answer one question quickly: what changed, and what depends on it?

ToolEcosystemStrengths
NxJavaScript/TypeScript, with plugins for other languagesProject graph, affected commands, local and remote caching, code generators
TurborepoJavaScript/TypeScriptSimple task pipelines with caching; easy to adopt
BazelMulti-language (open-sourced by Google)Hermetic, reproducible builds at very large scale; steeper learning curve
PantsPython, Go, Java and othersFine-grained dependency inference and caching
RushJavaScript/TypeScriptLarge Node.js monorepos with strict dependency policies
Package manager workspacesnpm, pnpm, Yarn, Cargo, Go workspacesLinking local packages without extra tools

Git itself has improved for large repositories: sparse checkout lets developers check out only the folders they need, and partial clone avoids downloading every historical file version upfront. Our guide to git worktree covers another way to work on several branches of a large repository at once.

Polyrepos need different tools: a private package registry for shared libraries, automated dependency updates to fight drift, cross-repo code search, and repository templates so new services start consistent.

CI in a Monorepo: A Worked Example

A dependency tree with one orange node, its two child nodes in grey and the other nodes light
A change to one package rebuilds only the projects that depend on it, not the whole repository.

The classic monorepo failure is CI that rebuilds and tests everything on every commit. With 40 packages and an average of 3 minutes to build and test each, a full run takes 120 minutes of compute.

With affected-only builds, the tool walks the dependency graph. A change to the shared auth package affects auth itself plus the five projects that import it, so CI builds and tests 6 packages: 18 minutes, 85% less. Add a remote cache, and anything already built with identical inputs, on CI or on a teammate's machine, is downloaded instead of rebuilt.

CI approachPackages builtCompute time
Build everything40120 minutes
Affected only618 minutes
Affected plus remote cache hits on 3 unchanged dependencies39 minutes

The figures are illustrative, but the pattern is why monorepos are practical at scale: without a dependency graph and caching, they slow down as they grow; with them, CI cost tracks the size of the change, not the size of the repository.

Monorepo vs Polyrepo: How to Choose

SituationLeans towardsWhy
Startup or small team with a few related appsMonorepoEasy sharing, one setup, fast cross-cutting changes
Front end, back end and shared types in TypeScriptMonorepoShared code and types without publishing packages
Many independent teams with separate productsPolyrepo, or several monoreposAutonomy and clear boundaries
Open-source libraries consumed by outsidersPolyrepo per library (often)Independent versions and contributor access
Strict access control between codebases (contractors, regulated code)PolyrepoRepository-level permissions
Large organisation with a strong platform teamEither; tooling decidesBoth scale with investment

Team size alone isn't decisive. A ten-person team with five unrelated products may be happier with separate repositories, while a thousand-person company with shared platform code may thrive in a monorepo. Look at how often changes cross project boundaries: the more they do, the more a monorepo pays off. Many organisations land in between: a handful of monorepos, one per product area or team, rather than one giant repo or hundreds of tiny ones. Whatever you choose, record the decision and its reasons; an architecture decision record is a good format.

Migrating Between Models

  • Polyrepo to monorepo: move repositories in one at a time, keeping history with git subtree or history-preserving import tools; introduce workspace tooling and affected builds before CI times climb.
  • Monorepo to polyrepo: extract a project with its history using tools such as git filter-repo, publish shared code as packages, and set up separate pipelines.

Either way, migrations touch every developer's workflow. Plan them in stages, and consider how you'll integrate changes, such as rebasing or merging, in the new layout; our comparison of git rebase vs merge covers that choice.

Common Mistakes

  • A monorepo without build tooling, so CI time grows with every new project.
  • A polyrepo without dependency automation, so services drift years apart.
  • Confusing monorepo with monolith.
  • No ownership rules in a shared repository.
  • Splitting too early, creating many tiny repos for a small team.
  • Moving everything at once during a migration.

FAQ

Is a monorepo the same as a monolith?

No. A monolith is one deployable application. A monorepo is one repository that can contain many independently deployed applications and services.

Do big companies use monorepos?

Some do, most famously Google, which described its single repository in a 2016 paper. Many others use many repositories, or a mix of both.

Are monorepos slow with Git?

Very large ones can be. Sparse checkout, partial clone and build tools with caching keep most monorepos fast; only the very largest need custom version-control systems.

Which is better for microservices?

On monorepo vs polyrepo for microservices, either works. A monorepo makes shared code and coordinated changes easier; a polyrepo gives each service more independence.

What is a polyrepo?

A setup where each project, service or library lives in its own repository, with its own history, versioning and pipeline.

All articles

Read next

Language

EnglishEnglish · en TürkçeTurkish · tr DeutschGerman · de العربيةArabic · ar

Account

Enter your email. We’ll send you a sign-in link and a 6-digit code. No password needed.

Sign in

Theme

Language

Show our email address

To keep spam out of our inbox, please confirm your own email first. We will send you a 6-digit code.

We send codes only to these providers: gmail.com, googlemail.com, outlook.com, hotmail.com, live.com, msn.com, proton.me, protonmail.com, pm.me, icloud.com, me.com, mac.com, yahoo.com, aol.com, gmx.de, gmx.net, web.de, t-online.de, yandex.com, omniai.blog