A monorepo stores multiple projects/packages in a single Git repository. A polyrepo gives each project its own repo.
Monorepo advantages:
- Atomic cross-package commits — one PR can change a shared library and all consumers simultaneously, keeping them in sync.
- Easier large-scale refactors — rename a function across 20 packages in one commit; no cross-repo PR coordination.
- Shared tooling — one ESLint config, one TypeScript config, one CI setup for all packages.
- Dependency visibility — you can see exactly which packages depend on what; circular deps are detectable at the repo level.
- Simpler DX —
pnpm install at root installs everything; no npm linking hacks needed.
Trade-offs:
- CI must be smart (only build/test affected packages) — tools like Turborepo and Nx handle this.
- Access control is coarser — everyone can see all packages. CODEOWNERS files mitigate this.
- Repo size grows — Git history includes all packages; shallow clones help.