Use Remote Caching (Nx Replay)

By default Nx caches task computations locally. However, to benefit from the cache across your team and in particular on CI, the computation cache can also be distributed across multiple machines.

The Nx Replay feature of Nx Cloud is a fast, secure and zero-config implementation of remote caching.

Diagram showing Teika sharing his cache with CI, Kimiko and James

In this diagram, Teika runs the build once on his machine, then CI, Kimiko and James can use the cached artifact from Teika instead of re-executing the same work.

Setting Up Nx Cloud

To use Nx Replay you need to connect your workspace to Nx Cloud. See the connect to Nx Cloud recipe.

See Remote Caching in Action

To see the remote cache in action, run:


nx build header && nx reset && nx build header

1> nx run header:build 2 3> header@0.0.0 build 4> rimraf dist && rollup --config 5 6src/index.tsx → dist... 7created dist in 786ms 8 9 ————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————— 10 11 > NX Successfully ran target build for project header (2s) 12 13 See logs and investigate cache misses at 14 15 16 > NX Resetting the Nx workspace cache and stopping the Nx Daemon. 17 18 This might take a few minutes. 19 20 21 > NX Daemon Server - Stopped 22 23 24 > NX Successfully reset the Nx workspace. 25 26 27> nx run header:build [remote cache] 28 29 30> header@0.0.0 build 31> rimraf dist && rollup --config 32 33 34src/index.tsx → dist... 35created dist in 786ms 36 37 ————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————— 38 39 > NX Successfully ran target build for project header (664ms) 40 41 Nx read the output from the cache instead of running the command for 1 out of 1 tasks. 42 43 Nx Cloud made it possible to reuse header: 44

Skipping Cloud Cache

Similar to how --skip-nx-cache will instruct Nx not to use the local cache, passing --no-cloud will tell Nx not to use the remote cache from Nx Cloud.