Microrepos vs Monorepos

A lot vs just one

Featured image

Source code, what is that?

Source code in version control refers to the practice of managing and storing the code of a software project using a version control system (VCS). A version control system is a tool that helps track changes to files, typically source code files, over time. This allows multiple people to work on the same project simultaneously, track the history of changes, and revert to previous versions of the code if necessary.

The key aspects of source code in version control include:

  1. Version Tracking: Each change made to the source code is tracked and recorded with a unique identifier, often called a commit or revision. This includes information about what was changed, who made the change, and when it was made.
  2. Branching and Merging: Version control systems allow developers to create branches, which are parallel versions of the source code. This enables developers to work on new features or fixes without disturbing the main codebase. These branches can later be merged back into the main codebase.
  3. Collaboration: Multiple developers can work on different parts of the same project simultaneously. Version control systems manage these concurrent changes and help resolve conflicts when merging different changes.
  4. Backup and Restore: The version control system serves as a backup, allowing developers to revert to previous versions of the code if something goes wrong with the current version.
  5. History and Audit Trail: The complete history of changes to the source code is maintained, providing an audit trail for what changes were made, by whom, and why.
  6. Code Review and Accountability: Version control systems facilitate code reviews by allowing other team members to examine changes before they are merged into the main codebase, fostering accountability and quality control.

Both “Microrepos” and “Monorepo” are strategies for storing source code in version control systems like Git. They each have their advantages and disadvantages, and the choice between the two often depends on the specific needs of a project or organization.

Microrepos (Multiple Repositories)

In a Microrepos setup, each project or service has its own separate repository. This is the traditional way of organizing source code and is often the default for smaller projects or organizations.

Advantages:

Disadvantages:

Monorepo (Single Repository)

In a Monorepo setup, multiple projects or services are stored in a single repository. This is a strategy often used by large organizations like Google, Facebook, and Microsoft.

Advantages:

Disadvantages:

Summary

This is my own personal opinion, as for my past experiences:

The choice between Microrepos and Monorepo often comes down to the specific needs and constraints of your team or organization, for the last 7 years of working with multiple teams and projects all around the world, I have seen both. They do the job well if the teams are also following best practices when using source code and developing not just code but also infrastructure.

References.

Build On!