πŸ“ Tutorials
Β· 3 min read
Last updated on

What is a Monorepo? Definition, Pros & Cons, and Tools (2026)


What is a monorepo?

A monorepo (short for β€œmonolithic repository”) is a single Git repository that contains multiple projects. Instead of having separate repos for your frontend, backend, and shared libraries, everything lives in one place.

Google, Meta, Microsoft, and Uber all use monorepos. But that doesn’t mean you should β€” it depends on your situation.

Monorepo vs. multi-repo

Multi-repo (one repo per project):

github.com/company/web-app        ← React frontend
github.com/company/api-server     ← Node.js backend
github.com/company/shared-utils   ← Shared library
github.com/company/mobile-app     ← React Native app

Monorepo (one repo, multiple projects):

github.com/company/platform
  β”œβ”€β”€ apps/
  β”‚   β”œβ”€β”€ web/          ← React frontend
  β”‚   β”œβ”€β”€ api/          ← Node.js backend
  β”‚   └── mobile/       ← React Native app
  β”œβ”€β”€ packages/
  β”‚   β”œβ”€β”€ shared/       ← Shared utilities
  β”‚   β”œβ”€β”€ ui/           ← Component library
  β”‚   └── config/       ← Shared ESLint/TS config
  └── package.json

Why use a monorepo?

Shared code is easy. Change a shared component, and every app that uses it gets the update immediately. No publishing packages, no version mismatches.

Atomic changes. Need to update the API and the frontend at the same time? One PR, one review, one merge. In multi-repo, that’s two PRs that need to be coordinated.

Consistent tooling. One ESLint config, one TypeScript config, one CI pipeline. Every project follows the same standards.

Easier refactoring. Rename a function in the shared library and update all consumers in the same commit.

Monorepo β‰  monolith

This is the most common misconception. A monolith is a single deployable application where everything is tightly coupled. A monorepo is just a repository structure β€” the projects inside can be completely independent microservices.

MonorepoMonolith
What it isOne repo, many projectsOne app, one deployment
CouplingProjects can be independentEverything is tightly coupled
DeploymentEach project deploys separatelyOne big deployment
ScalingScale individual servicesScale the whole thing

Google runs thousands of independent services from a single monorepo. The repo is shared, the services are not.

Related: Monolith vs Microservices

Why NOT use a monorepo?

Complexity. You need specialized tools (Turborepo, Nx, pnpm workspaces). Simple npm install doesn’t cut it.

CI gets slow. Changing one file triggers builds for everything unless you set up smart caching.

Access control. Everyone can see everything. If teams need isolated repos, monorepos make that harder.

Git gets slow. Very large monorepos (millions of files) can make Git sluggish.

Tools

ToolWhat it does
pnpm workspacesPackage management for monorepos
npm workspacesSame, built into npm
TurborepoBuild system with caching (by Vercel)
NxFull monorepo framework with plugins
LernaOlder tool, now maintained by Nx

Turborepo and Nx are the most popular monorepo frameworks in the JavaScript ecosystem. Turborepo focuses on speed through caching, while Nx offers a more opinionated, full-featured approach with generators and plugins.

Real-world monorepo examples

  • Google β€” One of the largest monorepos ever, containing billions of lines of code across nearly all of their products
  • Meta β€” React, Jest, Relay, and other open-source projects all live in Meta’s monorepo
  • Microsoft β€” Uses a monorepo for Rush, TypeScript tooling, and many internal projects
  • Vercel β€” Next.js, Turborepo, and the Vercel CLI are developed in a monorepo
  • Babel β€” The JavaScript compiler uses a Lerna-based monorepo with 100+ packages

Most open-source monorepos you’ll encounter use Turborepo, Nx, or Lerna for orchestration.

Quick setup with pnpm

# pnpm-workspace.yaml
packages:
  - 'apps/*'
  - 'packages/*'
// Root package.json
{
  "private": true,
  "scripts": {
    "dev": "turbo dev",
    "build": "turbo build",
    "test": "turbo test"
  }
}

See: pnpm cheat sheet for workspace commands.

When to use a monorepo

Yes if:

  • You have 2+ apps sharing code (frontend + backend, web + mobile)
  • You want consistent tooling across projects
  • Your team is small-to-medium and works across projects
  • You’re building a component library used by multiple apps

No if:

  • You have one app
  • Teams are completely independent and don’t share code
  • You don’t want to learn monorepo tooling
  • Your projects use completely different tech stacks

Related: What is a Microservice? A Simple Explanation for Developers Related: GitHub vs. GitLab β€” Which Platform Should You Use? Related: What is Docker? A Simple Explanation Related: Git complete guide