DEV Community

Lebogang Phoshoko
Lebogang Phoshoko

Posted on

Mind Blown By the World of Monorepos and the Build Tools that Power Them

It all started with a personal pain point: juggling frontend and backend code in separate repositories. The constant back-and-forth became quite tedious, and I knew there had to be a better way. That's when I stumbled upon the concept of monorepos.

Interestingly enough, my exploration coincided with a deep dive into trunk-based development on YouTube. One video mentioned Google's massive 86TB monorepo powered by their internal version control system, Piper, and their open-source build tool, Bazel (or Blaze, as it's apparently called internally, a detail I spotted in the source code!).

Being the curious soul I am, I immediately wanted to understand how their CI/CD magic worked. Bazel, however, proved to be quite the beast with a steep learning curve. Countless hours were spent binge-watching BazelCon videos, trying to piece together how it all worked. That's when I discovered Aspect, a build tool built on top of Bazel aiming to simplify its complexity. Huge shoutout to Alex Eagle's courses – they were instrumental in getting me up to speed with Bazel! While I'm still on the journey to mastery, the progress has been significant.

Bazel opened up a fascinating question: what other solutions exist for managing builds in a monorepo, and what are their unique approaches?

Enter Pants2! What an impressive tool. Just looking at the pants.toml configurations, you can tell it was designed with the goal of taming Bazel's complexity. I'm still exploring how it handles third-party packages, but it seems like most of what you need is built-in and can be easily enabled in the config file.

Down the rabbit hole I went, and Buck2 emerged. While I haven't yet fully explored its ecosystem, the potential is definitely there. However, managing external dependencies seems like a significant undertaking – a lot of manual configuration appears necessary, and I can only imagine the challenges of managing different versions, updates, and rollbacks at scale. It makes me wonder how Meta tackles this! Moving from Bazel to Buck2 felt like stepping into a more intimate, albeit less automated, environment.

As a relative newcomer to the tech scene, shiny new tools definitely pique my interest. But beyond the novelty, these tools often offer innovative and more efficient ways of tackling problems. It's not just about the "new," it's about the potential for improvement.

Turborepo by Vercel has also caught my attention. This JS/TS-focused tool is relatively new, but its future possibilities seem endless. The documentation even suggests it can work with any project containing a package.json. I've already had great success using it for both Python and TypeScript projects. Its simplicity makes it my go-to for smaller personal projects, especially for managing both backend and frontend in a single repo with a reliable CI/CD approach.

The concept of caching and sharing build caches across teams via remote caching with all these tools is truly game-changing. Experiencing Vercel's remote cache with Turborepo in my CI was mind-blowing – local builds followed by near-instant CI builds!

Ultimately, this deep dive has reinforced the idea that many large companies leverage monorepos and these powerful, multilingual build tools to streamline their CI/CD pipelines. It's been an incredibly insightful journey!

Image description
Image description
Image description
Image description
Image description

Top comments (0)