There is no doubt that microservices has dictated the current landscape in the web development world for the last 2 years. And a new trend emerging recently when many open source projects or startups moved from multiple repos to monorepo
Monorepo is not new, Google and Facebook have been using it for years. So why now? I believe it depends a lot on the maturity of building systems
- The repository contains more than one logical project (e.g. an iOS client and a web-application)
- These projects are most likely unrelated, loosely connected or can be connected by other means (e.g via dependency management tools)
- The repository is large in many ways:
- Number of commits
- Number of branches and/or tags
- Number of files tracked
- Size of content tracked (as measured by looking at the .git directory of the repository)
- Unified versioning, one source of truth;
- Extensive code sharing and reuse;
- Simplified dependency management;
- Atomic changes;
- Large-scale refactoring;
- Collaboration across teams;
- Flexible team boundaries and code ownership; and
- Code visibility and clear tree structure providing implicit team namespacing.
- Tooling investments for both development and execution;
- Codebase complexity, including unnecessary dependencies and difficulties with code discovery; and
- Effort invested in code health.
Facebook: With thousands of commits a week across hundreds of thousands of files, Facebook’s main source repository is enormous—many times larger than even the Linux kernel. Read more about Buck and Scaling Mercurial at Facebook
Google: Early Google employees decided to work with a shared codebase managed through a centralized source control system. This approach has served Google well for more than 16 years, and today the vast majority of Google's software assets continues to be stored in a single, shared repository. They use Bazel as build system
Twitter is using a custom build of Git which includes patches enhancing it to better deal with very large repositories in the range of multiple gigabytes
- create-react-app : create React apps with no build configuration
- react-router : Declarative routing for React
- storybook : Interactive UI component dev & test
- primer : the design system that powers GitHub
- reactotron : A desktop app for inspecting your React JS and React Native
- Bazel is Google's monorepo-oriented build system. More on Bazel: awesome-bazel
- Buck is Facebook's monorepo-oriented build system.
- Pants is a monorepo-oriented build system, used by Twitter, Foursquare and multiple other companies.
- MBT is a build tool with differential build support.
- Symplify\Monorepo is a PHP monorepo management tool.
Keep in mind monolithic source control does not necessarily result in monolithic software. And microservices can play well with monorepo
There are two basic types of Monorepos are huge repositories containing all the code maintained by a company or project specific Monorepos like Babel, React
Now you have a good overview of monorepo. I'll share about how to setup a monorepo, how it played nicely with CICD and how it affect developer experience later in another posts.
I recommend developers to give monorepo a try in coming year 2019 :D
- Mono-repo or multi-repo? Why choose one, when you can have both?
- Monorepo in the wild
- Why Google Stores Billions of Lines of Code in a Single Repository
- Monorepo in git
- Scaling Mercurial at Facebook
- Awesome monorepo
- Advantages of monorepo
- How to setup a monorepo
- All you always wanted to know about monorepo
This post was originally published at hoangbkit.com