Skip to content
Search

Monorepo

lastmod 2025-06-09created 2020-07-1011 edits

In version control systems, a monorepo is a software development strategy where code for many projects is stored in the same repository. As of 2017, this software engineering practice is over two decades old and is also called a 'shared codebase'.

Monorepo Projects

There are many solutions, but each has different goals.

  • Monorepo
  • Bazel (by Google) - A fast, scalable, multi-language and extensible build system.
  • Gradle (by Gradle, Inc) - A fast, flexible polyglot build system designed for multi-project builds.
  • Lage (by Microsoft) - Task runner in JS monorepos
  • Lerna - A tool for managing JavaScript projects with multiple packages.
  • Nx (by Nrwl) - Next generation build system with first class monorepo support and powerful integrations.
  • Rush (by microsoft) - Geared for large monorepos with lots of teams and projects. Part of the Rush Stack family of projects.
  • Turborepo (by Vercel) - The high-performance build system for JavaScript & TypeScript codebases.
  • Pants
  • Earthly

Choosing a Monorepo build tool

What is a Monorepo

Multiple separate projects held in a single Repo with well-defined relationships

Monorepo != Monolith

Why do it?

The reason people chose Polyrepo (the approach of using multiple Repos) was "team autonomy"

Teams can each choose the libraries they want and decide who contributes to and uses the code

  • With PolyRepo
    • Sharing code is cumbersome
    • Lots of code duplication
    • Critical bugs and big changes in shared libraries are costly
    • Inconsistent development tools across projects
  • With Monorepo
    • No overhead for creating new projects
    • Atomic commits across all projects
    • Everything managed with a single version number
    • Developer mobility (moving between projects)

Features provided by Monorepo tools and a comparison between tools

Bazel, Gradle, Lage, Lerna, Nx, Rush, Turborepo

  • Local caching
  • Local task orchestration
  • Distributed caching
  • Distributed task execution
  • Transparent remote execution
  • Detecting affected projects/packages
  • Workspace analysis
  • Dependency graph visualization
  • Code sharing
  • Consistent tooling
  • Code generation
  • Project constraints and visibility

A shift in mindset

A monorepo changes "the way you think about your organization and code"

  • By adding consistency,
  • reducing friction when creating new projects or performing large-scale refactoring,
  • and promoting code sharing and cross-team collaboration,
  • organizations can work more efficiently

See also

Favorite site

author Zer0 sitemap