The Resurgence of Monorepos in the AI Era
An exploration of Monorepos, their evolution from a niche hype to a pragmatic architectural choice. The discussion covers tooling, organizational impact, and why LLMs are driving a renewed interest in unified codebases.
The Modern Monorepo: Beyond the Hype
For years, the industry viewed Monorepos—single repositories containing multiple projects—as a trend primarily suited for giants like Google. However, we are seeing a significant resurgence. This isn't just about where code lives, but about reducing the friction inherent in modern software delivery.
The Friction of Polyrepos
In a Polyrepo environment, simple changes often require coordinated releases across multiple repositories. This leads to 'dependency hell,' where a change in a backend API necessitates a series of updates and version bumps across various frontend and mobile repositories. The result is increased communication overhead and slower release cycles.
Tooling as the Enabler
Modern tooling (such as NX) has transformed Monorepos from a management nightmare into a scalable asset. Key technological advancements include: * Project Graphs: Automatically mapping dependencies to ensure only affected projects are rebuilt. * Remote Caching: Sharing pre-compiled artifacts across teams and CI runners to slash build times. * Distributed Task Execution: Spreading workloads across multiple runners to prevent CI bottlenecks.
The AI Catalyst
Perhaps the most compelling reason for the current shift is the rise of AI Coding Agents and LLMs. AI models thrive on context. In a Monorepo, an AI agent has immediate access to the entire system's semantics—the API definitions, the frontend implementation, and the infrastructure code. This unified context allows AI to perform complex, cross-project refactors and feature implementations that would be impossible if the code were fragmented across dozens of repositories.
Conclusion
Adopting a Monorepo is as much an organizational decision as a technical one. It requires a culture of 'InnerSource' and a willingness to collaborate. However, for leadership and investment perspectives, the move toward unified codebases represents a strategic investment in developer velocity and AI-readiness.
Key insights
-
Monorepos are not binary choices between one giant repo for the whole company or individual repos per project; a hybrid approach based on domains or technology stacks is often the most pragmatic.
Impact: Allows organizations to balance team autonomy with the benefits of shared code and reduced coordination overhead.
-
AI agents and LLMs significantly benefit from Monorepos because they provide a unified semantic context, enabling the AI to understand dependencies and implement features across the entire stack autonomously.
Impact: Accelerates the transition from simple code completion to autonomous AI agents capable of handling complex, cross-service features.
-
The primary bottleneck in large Monorepos is CI/CD performance, which can be mitigated through 'affected' builds, remote caching, and distributed task execution.
Impact: Ensures that build and test times scale with the size of the change rather than the size of the overall repository.
-
A Monorepo promotes a culture of 'InnerSource,' encouraging developers to contribute across boundaries (e.g., a backend engineer fixing a frontend bug), which increases overall team mobility.
Impact: Reduces silos and eliminates the need for constant inter-team coordination for minor changes.
-
Tooling like project graphs and automated migrations is essential for maintaining long-term sustainability, preventing the codebase from becoming a chaotic 'big ball of mud.'
Impact: Maintains architectural integrity and prevents technical debt from accumulating as the organization scales.
Action items
-
Evaluate current pain points in the release process, specifically looking for 'dependency friction' where changes in one repo require manual updates in several others.
Impact: Identifies the concrete ROI for migrating to a Monorepo based on lost developer hours.
-
Implement an incremental adoption strategy by grouping closely related projects (e.g., Frontend and Design System) into a Monorepo before scaling to the whole organization.
Impact: Reduces organizational risk and allows the team to demonstrate immediate value through a 'magnetism' effect.
-
Invest in Monorepo-specific tooling that provides a project graph and remote caching to avoid the 'CI bottleneck' as the codebase grows.
Impact: Prevents developer frustration and keeps CI pipelines fast regardless of the total number of projects.
Quotes
“The scope in which AI agents move is constantly growing. And if you only have a small repo, you limit yourself.”
“Monorepo is not just a technical, but sometimes also an organizational topic.”
“The a-priori goal should be a Monorepo by default, and if there is already a super complex infrastructure, then consider exactly what effect you expect.”