What Is a Monorepo?
You'll learn what a monorepo is and how it contrasts with the traditional multi-repo approach to organizing code.
The Core Concept
A monorepo (short for "monolithic repository") is a software development strategy where multiple related projects, packages, or applications live in a single version control repository. Instead of having separate repositories for each package or service, everything shares the same codebase root.
Think of it like living in an apartment building versus separate houses. In a multi-repo (polyrepo) setup, each package is its own house with its own address — you maintain separate gardens, pay separate bills, and coordinate meetups requires planning. In a monorepo, everyone lives in the same building — shared infrastructure, easier communication, and centralized management.
Monorepo vs Multi-Repo
Multi-repo (polyrepo):
- Each package/project gets its own Git repository
- Dependencies between your own packages are published and installed via NPM/registries
- Changes spanning multiple packages require multiple PRs and version coordination
- Each repo has its own CI/CD, issue tracker, and tooling configuration
Monorepo:
- All packages share one Git repository
- Internal dependencies can reference each other directly (often through workspaces)
- Cross-package changes happen in a single commit
- Shared tooling, scripts, and configurations across all projects
Why This Matters
Companies like Google, Facebook, and Microsoft use monorepos for thousands of projects. With the right tools (workspaces in Yarn/PNPM/NPM, which you've learned about), a monorepo can simplify dependency management, enable atomic cross-package changes, and reduce version coordination overhead.
Key Takeaway: A monorepo houses multiple related projects in one repository, enabling easier coordination and shared tooling, while a multi-repo approach separates each project into its own isolated repository.