Bazel
Google's hermetic build system for monorepos. Incremental, multi-language builds with remote caching and remote execution. Used at Google, Stripe, Dropbox, Spotify, Databricks. Right tool when Turborepo and Nx don't scale far enough.
Overview
Overview
Bazel is Google's open-source build and test tool, released in 2015 as the externalized version of Google's internal Blaze system. It targets monorepos where conventional build tools break down: many languages, hundreds of services, thousands of engineers, and test suites measured in hours.
The whole design is one chain. You declare targets in BUILD files. Bazel joins them into one build graph that spans all languages. Each step in that graph runs in a hermetic sandbox, which means it sees its declared inputs only. Its outputs go into a content-addressed cache, both local and remote, and the result is correct incremental builds and tests. On a cache miss, the work can also be sent to a remote execution cluster instead of running on your machine.
Key concepts
- Packages, targets, and BUILD files
- Hermeticity and sandboxing
- Remote caching — end-to-end
- Starlark -- the BUILD file language
- Bzlmod -- modern dependency management (MODULE.bazel)
- Gazelle -- automatic BUILD file generation
- bazel query, cquery, and aquery
Interview questions
- Explain Bazel's hermetic build model. What does hermetic mean, why does it matter, and what are the most common ways it breaks?
- Walk me through setting up Bazel for a Go monorepo from zero.
- What is remote execution in Bazel? How does it differ from remote caching, and when does it justify the operational cost?
- When should a team choose Bazel over Nx or Turborepo for their monorepo?
- How does Bzlmod change dependency management compared to WORKSPACE, and what are the migration steps?
- What are the most common Bazel pitfalls in production, and how do you diagnose them?
Sign up free to read the full topic
More DevOps topics
- App of Apps Pattern
- Argo CD
- Argo CD at Scale — Sharding, Performance Tuning, Failure Modes and Mistakes
- Argo Workflows
- Backstage
- Bare-Metal Provisioning
- Bitbucket Pipelines
- Build Performance and Caching for C++
- Building MCP APIs and Servers
- Buildkite
- Buildpacks, Jib & ko
- C++ Dependency Management with Conan and vcpkg
Start free on Cariara · Coding problems · System design studio