Skip to content
rninja

Home / Use cases / Monorepos with a shared remote cache

Teams & monorepos

Monorepos with a shared remote cache

Let teams building overlapping subgraphs from the same sources reuse each other's results automatically.

The problem

In a monorepo, different teams build overlapping parts of the same dependency graph from the same source. Each developer and each CI lane recompiles shared libraries independently. The work is duplicated across the org because nothing shares the results — ninja has no notion of a cache that spans machines.

How rninja solves it

// Shared cache lookup

$ rninja -C out //libs/core:all
[cache] local miss → remote hit  libs/core/allocator.o
[cache] local miss → remote hit  libs/core/arena.o
 pulled shared artifacts, no recompile

Questions

[+] Do all teams need the same generator?

They need to produce equivalent actions from equivalent inputs. rninja keys on the action content, not the generator, so CMake, GN, Meson, or hand-written ninja files interoperate as long as the actual commands and inputs match.

[+] Is the remote cache required?

No. It is opt-in. Without it, rninja still gives you the local content-addressed cache and the async scheduler on every machine.

Try it on this exact workload

Install rninja, point it at your existing build.ninja, and time it side by side. See the quickstart or browse other use cases.