On this page
A monorepo is a single version-controlled repository that holds the code for many projects (services, apps, libraries and tools) that are developed side by side but keep their own boundaries. A polyrepo setup does the opposite and gives each project its own repository. A monorepo is not a monolith: it describes where code is stored, not how it is built or deployed.
Related: find circular dependencies in a monorepo and the best dependency graph tools for monorepos.
What is a monorepo?
A monorepo puts many projects under one repository, one history and usually one set of tooling, so a change that spans projects lands as one commit. A typical layout has deployable apps in one folder and shared packages in another:
acme/
apps/
web/ # Next.js frontend
api/ # Python API
worker/ # background jobs
packages/
ui/ # shared components
auth/ # shared auth client
config/ # lint and TypeScript config
pnpm-workspace.yaml
Each app still builds, tests and deploys on its own. What they share is the version history, the code review flow and the ability to change packages/auth and every caller of it in the same pull request.
Is a monorepo a monolith?
No. A monolith is an application built and deployed as one unit. A monorepo is a storage choice. One monorepo can hold dozens of services that each deploy on their own, and one monolithic application can be split across several repositories. The two get confused because both put a lot of code in one place. For the deployment question, see monolith vs microservices.
Monorepo vs polyrepo
A monorepo makes cross-project changes and code sharing cheap; a polyrepo makes isolation, access control and independent tooling cheap. Polyrepo is also called multi-repo.
| Monorepo | Polyrepo (multi-repo) | |
|---|---|---|
| Cross-project change | One commit, one pull request | One pull request per repo, merged in order |
| Shared code | Imported directly from the same tree | Published as versioned packages |
| Versioning | Often one version of each dependency for the whole repo | Each repo pins its own versions |
| CI | Needs affected-only builds to stay fast | Each repo's CI is small by default |
| Ownership | Per folder, through CODEOWNERS or similar | Per repository |
| Access control | Coarse; path-level rules need extra tooling | Fine-grained, per repository |
| Tooling | One build system and config across projects | Each team picks its own |
| Breaking changes | Visible at once, because callers are in the tree | Found later, when consumers upgrade |
| Scale limit | Clone size, CI time, tool performance | Coordination across repos |
Scroll the table sideways to see every column.
The deciding row is usually the cross-project change. If your teams change shared code and its consumers together every week, a monorepo removes a release step from each of those changes. If projects rarely touch each other, a polyrepo keeps each one small and independent.
How big is Google's monorepo?
In January 2015, Google's repository held about 1 billion files, 9 million source files, 2 billion lines of code and 35 million commits, with 86 TB of content and 40,000 commits per workday. Those figures come from Rachel Potvin and Josh Levenberg, Why Google Stores Billions of Lines of Code in a Single Repository, Communications of the ACM, July 2016.
The paper says the repository was used by 95% of Google's software developers and that, on a typical workday, they committed 16,000 changes while automated systems committed another 24,000. Google built its own version-control system, Piper, because no commercial or open-source system it tried handled that scale in one repository.
The paper lists the benefits as unified versioning, extensive code sharing, simplified dependency management, atomic changes, large-scale refactoring, collaboration across teams, flexible code ownership and code visibility. The drawbacks it names are the need to build and scale tools for development and execution, the work of maintaining code health, and the potential for codebase complexity such as unnecessary dependencies.
Is a monorepo worth it?
A monorepo is worth it when projects share code and change together often, and when you are willing to invest in build tooling that only rebuilds what a change affects. It costs more than it returns when projects are unrelated or when parts of the code must be hidden from most engineers.
Pick a monorepo when:
- Several apps share libraries, types or API clients and change them together.
- You want one place to run a refactor across every caller.
- You can run affected-only builds and tests, so CI time follows the change, not the repository.
Pick a polyrepo when:
- Teams ship on separate schedules with little shared code.
- Some code must be restricted to a small group.
- Projects use different languages and build systems with nothing to share.
Many teams end up with a mix: one monorepo per product area plus a few separate repositories. Moving between the two is a project in itself; migrating 50+ projects into a monorepo walks through the dependency mapping that comes first.
How to set up a monorepo
Start with your package manager's workspace feature, and add a build orchestrator only when CI time demands it. Workspaces link local packages to each other so one install covers the whole tree.
| Language | Workspace feature | Build orchestration |
|---|---|---|
| JavaScript / TypeScript | pnpm, npm or Yarn workspaces | Turborepo, Nx |
| Python | uv workspaces | Pants, Bazel |
| Go | go.work workspaces | Bazel |
| Rust | Cargo workspaces | Cargo, Bazel |
| Polyglot | Per language | Bazel, Buck2, Pants, Nx |
Scroll the table sideways to see every column.
A pnpm workspace is one file at the root:
# pnpm-workspace.yaml
packages:
- "apps/*"
- "packages/*"
A uv workspace lives in the root pyproject.toml:
[tool.uv.workspace]
members = ["packages/*"]
A Go workspace is one command:
go work init ./api ./worker ./shared
Then add three things before the repository grows: a CODEOWNERS file so each folder has a reviewer (see the CODEOWNERS guide), dependency rules that stop apps importing each other, and affected-only CI so a change to apps/web does not rebuild apps/api.
The problems a monorepo hides
A monorepo makes it easy to import anything from anywhere, so cycles, hub files and unclear owners grow without anyone deciding to add them. In a polyrepo, a new dependency on another team's code needs a published package and a version bump. In a monorepo it is one import line.
We measured how this plays out in 195 of the most-starred public repositories indexed on repowise.dev (1,000+ GitHub stars each, 253,688 production source files, November 2026), production code only:
| Finding (median repo unless stated) | Value |
|---|---|
| Repos with at least one circular import chain between files | 173 of 195 (89%) |
| Production files inside a circular import group | 9.2% |
| Share of production files that import the single most-imported file | 20% |
| Repos where one file is imported by a quarter or more of the codebase | 68 of 194 (35%) |
| Share of import edges into the top 1% of files | 17% |
| Top-level modules | 7 |
Scroll the table sideways to see every column.
A named example: in grafana/grafana, a monorepo of apps and packages, packages/grafana-data/src/index.ts is imported by 3,178 of 10,090 production files (31%), indexed October 28, 2026. A file with that reach is a deliberate public API, and it also means a change to it touches a third of the codebase.
Three problems to watch for:
- Cross-package cycles. Package A imports B, which imports A. The packages can no longer be built, tested or extracted separately. Find circular dependencies in a monorepo shows how to find them in TypeScript, Python and Go.
- Hub packages. One shared package that everything imports becomes the bottleneck for every release and every review.
- Unclear owners. A folder with no clear owner collects changes from every team and reviews from none.
Map a monorepo before you split or merge it
Before you split a monorepo, merge repositories into one or carve out a package, get the real dependency graph between packages and the owners of each one. Folder names describe intent. Imports, co-change history and commit authorship describe what the code does.
repowise builds that map from your code and git history. The architecture view shows packages and modules with the import edges between them, the circular groups, the hub files and a C4-style system diagram. Git intelligence adds who owns each package and which files change together across package boundaries, the coupling that no import shows. Open Grafana's architecture map to see it on a large monorepo, or the package view of React.
It runs on large monorepos on one machine: the large monorepo guide measures a first index of elastic/elasticsearch (4.0 million lines) in 52 minutes and dotnet/runtime (15.0 million lines) in 120 minutes, with full git history.
For a polyrepo, a repowise workspace indexes several repositories together and matches the HTTP, gRPC and event contracts between them, so a change in one repository shows the consumer files in another. See how to index a monorepo for docs, graphs and ownership for the full walkthrough.
FAQ
- Is a monorepo worth it?
- A monorepo is worth it when projects share code and change together often, because one commit can update a library and every caller. It needs affected-only builds and clear folder ownership to stay fast. When projects are unrelated or need strict access control, separate repositories are simpler.
- How big is Google's monorepo?
- In January 2015, Google's repository held about 1 billion files, 9 million source files, 2 billion lines of code and 35 million commits, with 86 TB of content and 40,000 commits per workday. The figures come from Potvin and Levenberg's July 2016 article in Communications of the ACM.
- What is the difference between a monorepo and a polyrepo?
- A monorepo stores many projects in one repository with one history, so cross-project changes land as one commit. A polyrepo gives each project its own repository, so projects share code through versioned packages and change independently. Monorepos favor shared changes; polyrepos favor isolation and per-repo access control.
- Is a monorepo a monolith?
- No. A monorepo is a way to store code; a monolith is a way to build and deploy an application as one unit. A monorepo can hold many independently deployed services, and a monolith can be split across several repositories.
- What tools manage a monorepo?
- Package-manager workspaces handle linking: pnpm, npm and Yarn workspaces for JavaScript, uv workspaces for Python,
go.workfor Go and Cargo workspaces for Rust. Build orchestrators such as Turborepo, Nx, Bazel and Pants add caching and affected-only builds once CI time grows.



