Git & GitHub
/Advanced
Monorepos
Definition
A software development strategy where code for many projects is stored in the same repository, as opposed to storing them in separate repositories (polyrepo).
Explain Like I'm New
Putting your Frontend app, your Backend API, and your Mobile App into one giant Git repository. They share the same `node_modules`, the same ESLint rules, and the same Git history.
Real World Example
Google famously has the largest Monorepo in the world. Almost all of Google's code (billions of lines) lives in a single repository.
Common Use Cases
- •Easy code sharing between frontend and backend
- •Atomic commits across entire tech stacks
Terminal Output
bash / terminal
/*
A typical Monorepo folder structure:
my-startup-monorepo/
│
├── package.json (Global dependencies)
│
├── apps/
│ ├── web-frontend/ (React App)
│ ├── mobile-app/ (React Native)
│ └── admin-dashboard/
│
└── packages/
├── shared-ui/ (Buttons, Inputs used by all apps)
└── database-orm/ (Prisma schema used by API)
*/
Interview Questions
basic
- What is the main problem with Monorepos?
intermediate
- What tools are commonly used to manage JavaScript monorepos?