Introduction to Monorepos

Published on July 2, 2024

Introduction to Monorepos

Monorepos, short for “monolithic repositories,” are a source code management structure where multiple applications or projects reside within a single repository. Instead of splitting code into smaller repositories, each application is managed as a separate part within a large shared repository. In simpler terms, rather than configuring commitlint, prettier, and stylelint separately for each backend (BE) and frontend (FE) project, monorepos allow us to configure these tools at the root level and share them across projects. We can start, test, build, and run projects outside the root for individual subprojects or concurrently, avoiding the need to work independently within each project.

Consider this scenario: You’re part of a team responsible for a project with three application components: Frontend (multiple web apps), Backend, and UX/UI. When the UX/UI team modifies a shared component—for example, changing a button design—here’s how monorepos compare to multi-repos:

  1. Multi-repo Approach:
    • Each frontend team must access the specific application repository and update the shared component. This process affects code maintenance and synchronization.
  2. Monorepo Approach:
    • Only one frontend developer needs to access the shared library folder and make the necessary changes once.

Similarly, if the entire system needs to switch time zones from UTC+7 to UTC+9 by installing a package like date-fns-tz and adjusting the date display logic (e.g., from yyyy-MM-dd to yyyy年MM月dd日):