Understanding the evolution of monorepos is critical for any development team considering this approach to source code management. This guide delves deep into the history of monorepos, highlighting key dates, figures, companies, and anecdotes that have shaped its development.
A monorepo, short for a monolithic repository, refers to the practice of storing all of an organization's code in a single repository. Unlike polyrepos, where each project or service has its own repository, monorepos allow for simplified cross-project refactoring, unified versioning, and cohesive tooling strategies.
The monorepo concept isn't new; it has roots dating back to the early days of version control systems (VCS). Large companies such as Google and Facebook pioneered the use of monorepos early on, recognizing the need for a scalable solution to manage their vast and rapidly growing codebases.
Google: Adopted a monorepo structure to manage billions of lines of code, setting a precedent for other tech giants.
Facebook: Utilized a monorepo for its enormous and complex codebase, contributing to the popularity of the approach.
The monorepo approach sparked debate among developers and companies, contrasting with the more traditional polyrepo approach. Arguments centered on scalability, ease of collaboration, and the balance of autonomy vs. centralized control.
The rise of monorepos necessitated the development of new tools to manage complexities associated with large-scale codebases.
Bazel: Developed by Google, Bazel is a build tool that supports monorepo configurations.
Buck: Created by Facebook, Buck is another build system designed with monorepos in mind.
Today, monorepos are supported by modern tools like Lerna, NX, and Turborepo, which have made the monorepo approach more accessible to a broader range of companies beyond tech giants.
Recent advancements in tooling have addressed earlier limitations of monorepos, such as build optimization, caching, and distributed task execution, making the approach more viable for companies of various sizes.
Real-world examples from companies that have adopted monorepos provide valuable insights into the practical benefits and challenges of this approach.
Twitter: Transitioned to a monorepo to improve its development workflow.
Microsoft: Uses monorepos for some of its largest and most critical projects.
At Watershed, a software engineer reported improved development workflows due to the monorepo structure facilitated by Turborepo. The centralized codebase made it easier to update packages across projects, collaborate, debug, and enforce standards across the organization. The ability to set up testing, linting, formatting, and publishing tasks in one place allowed for more manageable dependencies and reduced the chances of toolchains becoming outdated.
Coinbase developed an efficient and reliable Python ecosystem using Pants, overcoming the challenge of managing Python applications at a large scale. On October 27, 2022, they released further details on the CI/CD infrastructure and dependency management within their Python ecosystem, highlighting the advantages of their monorepo approach.
Looking ahead, monorepos are likely to evolve further as companies continue to seek efficient ways to manage increasingly complex and interconnected systems. Continuous integration and deployment (CI/CD) pipelines, code review processes, and other development practices will adapt to accommodate the monorepo philosophy.
Monorepos represent a significant shift in how organizations manage source code. While not a one-size-fits-all solution, they offer a compelling model for improving developer workflows, enhancing collaboration, and streamlining project management.