Reflect on your 2024 year in code

Graphite for monorepos

Sara Verdi
Sara Verdi
Graphite software engineer
Try Graphite

Used by many of the world’s largest and fastest-moving eng teams like Meta, Google, Airbnb, and Shopify, monorepos are single version-controlled repositories that contain the code for multiple projects, components, or services. In the early days of software development, monorepos were the standard, but the rise of microservices, containerization, and Kubernetes over the past decade has led many teams to adopt multiple separate repositories (polyrepos), a trend further supported by platforms like GitHub.

While polyrepos can help teams keep their codebases organized and reduce the overhead of reviewing, testing, and merging pull requests, they also come with costs:

  • Increased complexity in code sharing
  • Challenging dependency management
  • Fragmented development processes
  • Significant context-switching overhead

Initially, many teams felt that these costs were still outweighed by the benefits of working with polyrepos. However, as GitOps practices evolved and deployments from a single commit have become more common, the idea of using a single repository to align a service, its deployment pipeline, and its development team quickly became more appealing again.

Monorepos are particularly beneficial for large-scale software projects because they allow teams to align development, testing, and deployment workflows across different projects, apps, and services. By centralizing all of an organization’s code in one place, teams benefit from a whole host of advantages, including:

  • Streamlined changes: Update multiple services with a single commit, simplifying the development and deployment processes.
  • Accelerated development: Cut down build times and CI cycles with easier dependency management.
  • Unified codebase: Provide a single source of truth for all code, eliminating knowledge silos while allowing developers to share code faster.
  • Consistent practices: Enforce standardized coding styles, testing, and deployment practices across the entire organization.
  • Simplified dependency management: Manage all dependencies in one place to prevent version conflicts.
  • Increased efficiency: Share tooling and infrastructure to reduce onboarding and integration issues, enhancing overall workflow efficiency.

Monorepos offer significant benefits, but without the right tooling they also introduce potential complications like increased merge conflicts and complex integration processes. Luckily, Graphite provides an end-to-end toolchain to help teams on GitHub work seamlessly in monorepos. Here’s why engineering leaders are turning to Graphite:

Large-scale monorepos often lead to overlapping code changes that become hard to manage. Graphite enables developers to stack pull requests, so they can break large changes into smaller, sequential pieces while keeping the development process fluid. Stacking means you don’t have to wait for one PR to merge before starting on the next—keeping engineers productive and unblocked.

Merge conflicts are inevitable, but they don’t have to be painful. Traditional approaches rely on developers to rebase their changes manually, which takes time and increases the risk of errors. Graphite’s Merge Queue automates this tedious process, quietly running in the background to ensure your PRs (or stacks of PRs) stay in sync with the trunk branch. This minimizes merge conflicts and keeps your main branch “green,” so instead of putting out fires, your team can focus on building.

Building a distributed team means access to top talent worldwide, but it can also make collaborating on pull requests a stop-and-start process, particularly for teams working in monorepos. Graphite keeps developers unblocked with stacked pull requests, a shared pull request inbox, and actionable Slack notifications for async reviews. Many distributed teams are also turning to Graphite Reviewer to give their engineers real-time, actionable feedback on every pull request, reducing review cycles and helping them ship around the clock and around the globe.

Lengthy CI checks can bottleneck your team’s productivity. With Graphite’s CI optimizations and stack-aware Merge Queue, we’ve built a smarter solution. Our merge queue identifies redundant CI tests and optimizes them by merging stacks of PRs as one, drastically reducing the time and resources spent running duplicate checks. Whether you’re running long checks or have a high PR merge rate, Graphite ensures your development pipeline moves faster with fewer disruptions.

Transitioning to a monorepo environment can improve the way your team collaborates, tests, and deploys code by addressing challenges like constant rebasing, lengthy CI cycles, and frequent integration issues. Graphite provides the tools your teams need to make this shift by automating merge conflict resolution, simplifying pull request workflows with stacked changes, optimizing CI processes to reduce redundancy, and maintaining the stability of your main branch for deployments. Plus, setup is straightforward, and the impact on your development workflow is immediate.

Visit our documentation to see how Graphite can help your team unlock the full potential of monorepos with faster, more reliable development cycles and smoother collaboration across projects.

Built for the world's fastest engineering teams, now available for everyone