Skip to content
Documentation

Docs / Adapter commands / Nx

Nx adapter

Keep Nx task hashes and artifact behavior. The adapter provides the self-hosted remote-cache endpoint and short-lived process credential.

Command
boringcache nx
Protocol
Nx self-hosted remote cache over /v1/cache/*
Action
mode: nx

How the adapter works

Task-output cache

Nx keeps its task hashing and output model. BoringCache provides the self-hosted remote-cache endpoint.

Same cache story outside Nx

Docker builds, archive paths, Go cache, and compiler cache can use the same workspace.

Restore-only CI path

Pull requests can restore task outputs without publishing cache into trusted branches.

Set up Nx

Keep the command and cache tag in .boringcache.toml, then use the same boringcache nx entrypoint locally and in CI.

[adapters.nx]
tag = "nx-cache"
command = ["nx", "affected", "--target=build"]

# Run: boringcache nx

Before the first run

  • Install the repository's Node package manager and Nx version.
  • Review active Nx Cloud bindings when a build still talks to another cache service.
  • Keep task inputs deterministic; Nx continues to calculate the task hashes.

Use the same adapter in GitHub Actions

The Action starts the Nx adapter and gives the later Nx command its remote-cache environment.

.github/workflows/ci.yml
- uses: boringcache/one@f0fb9b2d926a32b10c543e92093ba00c5a291b79 # v1.33.0
  with:
    trust-policy: auto
    mode: nx

- run: pnpm nx run-many -t build

Approve the repository through Connect CI and grant the job contents: read and id-token: write. The Action uses that Machine connection. Pull requests restore by default; trusted jobs may publish. See the authentication example in the GitHub Actions reference for scoped credentials when OIDC is unavailable.

GitHub Actions reference

Benchmarks

Storybook · Nx remote cache.

70–94%

Less cache to store

BoringCache stored 70–94% less cache data across public Go, Gradle, Maven, Nx, Turbo, and sccache comparisons.

Open run →

Tool reference

Check the tool's own reference when you need cache-key rules, build settings, or version-specific behavior.

All adapter commands

Compare every supported command, protocol, and Action mode in one place.

Adapter command index →

Need help or found something unclear? Open an issue or browse the CLI repo.