Basic Coding Info/Monorepo

What is a Monorepo?

brightlightkim 2022. 6. 8. 04:27

WHAT IS A MONOREPO

A monorepo is a project which contains smaller projects -- whereas each project can be anything from individual application to reusable package (e.g. functions, components). The practice of combining projects dates back to the early 2000 when it was called a shared codebase.

The name monorepo stems from the words mono (single) and repo (repository). While the former is self-explanatory, the latter comes from version control systems (e.g. git) where either projects:repositories are hosted in a n:n relationship (polyrepo) or a n:1 relationship (monorepo).

Often a monorepo is mistaken for a monolith. However, in a monolithic application all smaller projects are combined into one large project. In contrast, a monorepo can combine its smaller projects into multiple projects.

Monorepos are popular for large scale codebases used by large companies such as Google:

  • "The Google codebase includes approximately one billion files and has a history of approximately 35 million commits spanning Google's entire 18-year existence." [2016]
  • "Google's codebase is shared by more than 25,000 Google software developers from dozens of offices in countries around the world. On a typical workday, they commit 16,000 changes to the codebase, and another 24,000 changes are committed by automated systems." [2016]

However, these days monorepos become popular for any codebase which has multiple applications with a shared set of (in-house) packages ...

 

WHY USE A MONOREPO

There are two major advantages using a monorepo for a large scale codebase. First of all, shared packages can be used in multiple applications on a local machine without an online registry (e.g. npm). The developer experience improves tremendously here, because everything is in the same codebase without updating dependencies via third-parties. When a shared package gets updated, it gets immediately reflected in all applications which depend on it.

 

Second, it improves collaboration across codebases. Teams working on different projects can improve the codebases from other teams without working on multiple repositories. It also improves accessibility without worrying about different setups and introduces a more flexible ownership of the source code across teams. Another benefit is the refactoring of code across many projects.

'Basic Coding Info > Monorepo' 카테고리의 다른 글

Monorepo Structure  (0) 2022.06.08