DEV Community

Wakeup Flower
Wakeup Flower

Posted on

Monorepo, Polyrepo, Monolith & Microservices

Monorepo ( Google, Facebook, Airbnb )

One codebase for multiple projects

my-monorepo/
├── apps/
│ ├── api/
│ └── web/
├── libs/
│ ├── auth/
│ └── utils/
├── package.json
├── tsconfig.json

Tools to Manage Monorepos:

  • Nx (popular with NestJS & Angular)
  • Turborepo
  • Lerna
  • Bazel (used by Google)
  • Rush

Polyrepo (Multi-repo) (Netlifx)

the opposite of monorepo, everything's seperated, each app or service is in its own separate Git repository

Modular Monolith

One large application structured into internal modules (but not separate services).

monolith-app/
├── src/
│ ├── modules/
│ │ ├── users/
│ │ ├── orders/
│ │ ├── auth/
│ └── main.ts
├── package.json
└── tsconfig.json

Microservices can be present as Monorepo or Polyrepo

Example using Nx

apps/
api/ ← NestJS backend
admin/ ← Angular admin panel
site/ ← Next.js frontend

libs/
auth/ ← Shared between frontend and backend
ui/ ← Shared React components

Top comments (1)

Some comments may only be visible to logged-in visitors. Sign in to view all comments.