Skip to content

Technical decisions

Elton Garbin edited this page Jul 25, 2021 · 6 revisions

Monorepo

A monorepo is a version-controlled code repository that holds the source code for multiple applications and libraries, along with the tooling for them. The opposite of the monorepo is multirepo, where each project is held on an entirely separate, version-controlled repository.

This repository ocean-web follows a monorepo approach, all officially maintained modules are in the same repo. And here are the pros and cons that we take into consideration:

Pros

  • Single source of truth: all code is located in one repository, remove the need for npm/yarn link or individually update different repos.
  • Visibility: everyone can see everyone else’s code. This property leads to better collaboration and cross-team contributions.
  • Code sharing: keeps your code DRY across your entire organization. Reuse validation code, UI components, and types across the codebase.
  • Consistency: enforcing code quality standards and a unified style is easier when you have all your codebase in one place.
  • Atomic commits: atomic commits make large-scale refactoring easier. A developer can update several packages in a single commit.
  • Simpler dependency management: sharing dependencies is trivial. There’s little need for a package manager as all modules are hosted in the same repository.
  • Unified CI/CD: you can use the same CI/CD deployment process for every package in the repo.

Cons

  • No way to restrict access only to some parts of the codebase. Unfortunately, you can’t share only the part of your monorepo—you will have to give access to the whole codebase, which might lead to some security issues.
  • Poor Git performance when working on large-scale projects. This issue starts to appear only on huge applications with more than a million commits and hundreds of devs doing their work simultaneously every day over the same repo.
  • Higher build time. Because you will have a lot of source code in one place, it will take way more time for your CI to run everything in order to approve every PR.

Examples

Babel, React, Jest, Vue, Angular, Create-React-App, Material-UI, Next and much more.

Learn More

Lerna & Yarn Workspaces

Github Actions

Typescript

Sass

Clone this wiki locally