Skip to content
Nx Cloud CI is in private beta 10.6× faster average CI time with 79% less compute. Join the beta
Let an AI agent set it up for you

Help me set up CI for my Nx workspace on Nx Cloud CI.

Before touching anything, verify the workspace state:

A. Is Nx installed?

- Check for `nx.json` and `nx` in `package.json` devDeps.

- Confirm `node_modules` exists. If not, install deps using the package manager that matches my lockfile (`pnpm install`, `npm install`, or `yarn`).

- If `nx.json` is missing entirely, ask me before running `npx nx@latest init`.

B. Where is the repository hosted?

- Check `git remote -v`. Nx Cloud CI needs a github.com repository. If it's anywhere else, stop and point me to /docs/kb/bring-your-own-ci.

C. Is there an existing CI setup?

- If `.nx/pipelines/ci.yaml` has `on` and `jobs`, Nx Cloud CI is already set up. Confirm with me before changing anything.

- If `.nx/ci-config.yaml` exists, tell me it's deprecated and point me to /docs/kb/migrate-from-ci-config.

- If there's a provider workflow (for example `.github/workflows/*.yml`), tell me Nx Cloud CI runs alongside it until I remove it, and point me to /docs/kb/migrate-from-github-actions to convert it.

Then set up Nx Cloud CI:

1. Point me to https://cloud.nx.app/get-started?plan=nx-cloud-ci to sign in and pick Nx Cloud CI. Stop until I confirm.

2. Run `npx nx-cloud onboard connect-workspace` and parse the JSON. If the response includes an `actionRequired` payload (typically GitHub authorization), surface the message and any URLs to me and stop. Do not retry blindly.

3. Confirm `nxCloudId` is written to `nx.json`. If it is not, surface the JSON error to me instead of retrying.

4. Create `.nx/pipelines/ci.yaml` from the complete example on https://nx.dev/docs/getting-started/setup-ci.md. Replace `lint test build` with the targets my workspace has.

Stage the generated or edited files but do not commit on my behalf. For deeper coverage link to https://nx.dev/docs/getting-started/setup-ci.md and to /docs/features/ci-features (/docs/features/ci-features).

Page: https://nx.dev/docs/getting-started/setup-ci.md

Help me set up CI for my Nx workspace on Nx Cloud CI.

Before touching anything, verify the workspace state:

A. Is Nx installed?

- Check for `nx.json` and `nx` in `package.json` devDeps.

- Confirm `node_modules` exists. If not, install deps using the package manager that matches my lockfile (`pnpm install`, `npm install`, or `yarn`).

- If `nx.json` is missing entirely, ask me before running `npx nx@latest init`.

B. Where is the repository hosted?

- Check `git remote -v`. Nx Cloud CI needs a github.com repository. If it's anywhere else, stop and point me to /docs/kb/bring-your-own-ci.

C. Is there an existing CI setup?

- If `.nx/pipelines/ci.yaml` has `on` and `jobs`, Nx Cloud CI is already set up. Confirm with me before changing anything.

- If `.nx/ci-config.yaml` exists, tell me it's deprecated and point me to /docs/kb/migrate-from-ci-config.

- If there's a provider workflow (for example `.github/workflows/*.yml`), tell me Nx Cloud CI runs alongside it until I remove it, and point me to /docs/kb/migrate-from-github-actions to convert it.

Then set up Nx Cloud CI:

1. Point me to https://cloud.nx.app/get-started?plan=nx-cloud-ci to sign in and pick Nx Cloud CI. Stop until I confirm.

2. Run `npx nx-cloud onboard connect-workspace` and parse the JSON. If the response includes an `actionRequired` payload (typically GitHub authorization), surface the message and any URLs to me and stop. Do not retry blindly.

3. Confirm `nxCloudId` is written to `nx.json`. If it is not, surface the JSON error to me instead of retrying.

4. Create `.nx/pipelines/ci.yaml` from the complete example on https://nx.dev/docs/getting-started/setup-ci.md. Replace `lint test build` with the targets my workspace has.

Stage the generated or edited files but do not commit on my behalf. For deeper coverage link to https://nx.dev/docs/getting-started/setup-ci.md and to /docs/features/ci-features (/docs/features/ci-features).

Page: https://nx.dev/docs/getting-started/setup-ci.md

Run your whole pipeline on Nx Cloud CI from one file in your repository. Remote caching, nx affected, and self-healing CI work without extra steps, and spreading tasks across machines takes one line. For a finished pipeline, jump to the complete example.

Nx Cloud CI is in beta for repositories on github.com, with more providers coming soon. If your repository is somewhere else, or you'd rather keep your current CI provider, see bring your own CI.

For existing repos, run the init command and follow the prompts:

Terminal window
npx nx@latest init

Or start fresh with a new repo:

Terminal window
npx create-nx-workspace@latest

Push your workspace to GitHub, then sign in to Nx Cloud and connect it through the GitHub App:

Nx

Connect your workspaceSetup takes less than 5 minutes

Nx Cloud is free to start, and the CI Plan is $0 during the beta. Once connected, remote caching works on your machine and in CI. A task that already ran with the same inputs, in CI or on a teammate's machine, is restored from the cache instead of running again. Because Nx Cloud CI runs tasks on Nx Cloud workers, Ultracache configures each task's inputs and outputs from the files it reads and writes, so you don't declare them by hand.

Commit a pipeline file on a branch and open a pull request into main:

.nx/pipelines/ci.yaml
# ... name and triggers
jobs:
main:
runs-on: linux-medium-js
steps:
- run: npx nx affected -t lint test build

linux-medium-js is a pre-built launch template that checks out your repository and installs its dependencies. Before your first step, Nx Cloud sets NX_BASE and NX_HEAD, so nx affected runs tasks only for projects your change touches, with no extra setup. For the triggers, see the complete example.

Caching, affected, and distribution only apply to tasks that nx runs. nx test is fine, and so is npm test if it wraps nx test. Direct calls to jest, tsc, or eslint skip Nx.

With workers, your tasks run across several machines instead of one. With dynamic task packing, Nx Cloud uses what it knows about each task, such as its duration and its CPU and memory use, to keep workers close to capacity, so fewer machine-minutes sit idle. In most workspaces, that adds up to about 50% fewer machine-minutes than remote caching alone.

The job distributes tasks to its own main-job worker. To run them across more machines, add workers to the job:

.nx/pipelines/ci.yaml
jobs:
main:
runs-on: linux-medium-js
workers: 3 linux-large-js
steps:
- run: npx nx affected -t lint test build

This pipeline combines affected, remote caching, and distribution:

.nx/pipelines/ci.yaml
name: CI
on:
pull-requests:
event: PR
branches: [main]
main-pushes:
event: PUSH
branches: [main]
worker-templates:
default:
# Distribute across 3 workers using the linux-large-js launch template
workers: 3 linux-large-js
# Shut idle workers down once every build task has been requested
stop-after:
- build
jobs:
main:
# Checks out the repository and installs dependencies
runs-on: linux-medium-js
workers: default
steps:
# Runs lint, test, and build only for projects affected by this change.
# Nx Cloud distributes these tasks across the workers started above.
- run: npx nx affected -t lint test build

Nx Cloud CI runs alongside any CI you already have, so CI runs twice until you remove the old workflow. To convert a GitHub Actions workflow, see move a GitHub Actions workflow to Nx Cloud CI.