As the name suggests, a single repository (on github lets say) that holds all your frontend, backend, devops code.

1. Simple folders → Why not?

Why cant I just store services (backend, frontend etc) in various top level folders?

You can, and you should if your

  1. Services are highly decoupled (dont share any code)
  2. Services don’t depend on each other.

For eg - A codebase which has a Golang service and a JS service

notion image

Turborepo is a container repo that has all the sub-repos used in a fullstack project. If a project has a frontend, a backend, a flask server, etc, it doesnt make sense to create different repos and handle all the data.

2. Monorepos

A monorepo framework provides tools and conventions for managing projects that contain multiple packages or applications within a single repository (monorepo). This includes dependency management between packages, workspace configuration.

There are various reasons as to why a monorepo architecture wins over simple folder architecture. The reasons are as follows,

  1. Shared code architecture → I can share code between different projects for example, a component used in a react project can be shared in a NextJS project.
  2. Enhanced Collaboration → Understanding the broad code overview of the entire org is easier when compared to navigating to different repos and understanding various code-bases
  3. Optimized Builds and CI/CD → Tools like turborepo offer smart caching and task execution strategies that can significantly reduce build and testing times.
  4. Centralized Tooling and Configuration → Managing build tools, linters, formatters, and other configurations is simpler in a monorepo because you can have a single set of tools for the entire project.

image.png

3. Common monorepo frameworks

  1. Lerna - https://lerna.js.org/
  2. nx - https://github.com/nrwl/nx