Monorepo development is the source of a heated discussion. Combining multiple repositories into a single one guarantees all the code across projects works smoothly. However, it is not a silver bullet in every case. Let’s grasp some insights, and get to know monorepo’s benefits, as well as challenges. I’ve been building dev tools for monorepos to help manage large projects for companies for quite some time. As a result, I meet the pros and cons of monorepo idea. That’s why I’d like to introduce you to the topic and resolve doubts about whether switching to monorepo is worth considering.
Table of Contents
Things you will learn
Is it worth switching to monorepo, and when it’s better to abandon this idea? Why do big companies go for this solution, and what are its main advantages? I want to share with you my thoughts on the following issues:- The idea behind monorepo development: how it works, and what are the benefits,
- What’s the difference between monorepos and multi-repos,
- The biggest challenges of monorepo,
- Why is it worth introducing this solution into the project?
All you need to know about monorepo
First, let’s say a few words about monorepos, the so-called monolithic repositories. Simply put, it is a code repository that contains many sub-projects. It also helps to manage multiple projects that aren’t necessarily related. Monorepos enable holding logically independent projects, often run by various teams. Pro tip: You need to remember that managing distinct projects in monorepo in Git involves many conceptual challenges. For instance, whenever you make a commit, Git tracks the state of the whole tree, which is fine for single or corresponding projects.How does monorepo work?
Usually, dev teams divide the code of different app components into subfolders. Then, they use Git workflow to develop further features or fix the bugs. This is typical for most applications or systems based on monolithic architecture. Monorepos allows you to keep all your application and microservice code in the same source code repository (usually in Git). It can be used to merge repositories in a GitLab or a Bitbucket Cloud. Monorepos definitely accelerate workflow in big projects due to automation which ensures transparency within various teams. It becomes especially useful when one team runs tests, and the other gets instant access to their status.Monorepos vs. multi-repos
Monorepos are often mistaken for multi-repos, although these are various concepts. Here’s the biggest difference:- Monorepo – a monorepository is an architectural concept. Monorepos allows for keeping all isolated code chunks within a single repository. Thanks to monorepo, you don’t have to manage multiple repositories separately. Instead, you can store different projects inside one repo, e.g. a website and its iOS app.
- Multi-repos – multirepo is actually the complete opposite of monorepo, and is used at the start of the project. Here, every project is kept in a totally separate, version-controlled repository.
The benefits of monorepo
Why do big names such as Google, Facebook, or Uber decided to go for monorepos? There are some reasons for this choice. Operating on a monolithic repository has got lots of advantages, for the team’s workflow and business scale-up, as well.- Diminished silos between teams
- Unification of CI/CD
- Improved standardization
- Simplified dependency management
Monorepo development challenges
Let’s face it, when you want to execute some innovation in the project, you’ll encounter many obstacles. Each company has its system and habits. If you introduce monorepo solution across a large project from the scratch, you have to face some challenges. Shattering the old ways of functioning and setting up things from the start carries out some risks, such as:- Learning difficulty
- Ownership issues
- Workflow disruptions