CLI tool
nrwl/nx avatar
nrwl/nx

Nx: Incremental Builds and Task Caching for TypeScript Monorepos

The Monorepo Platform that amplifies both developers and AI agents. Nx optimizes your builds, scales your CI, and fixes failed PRs automatically. Ship in half the time.

29,332 stars2,997 forksTypeScriptMIT

At a glance

What is it?
Nx is an MIT-licensed monorepo toolchain that reads your existing package.json scripts, hashes task inputs, and runs only what changed. This article covers the mechanism, the commands and config keys the documentation names, and the point at which a single-package repository stops needing it.
Who is it for?
Adopt Nx when you already have several packages in one npm, pnpm or yarn workspace and CI time is dominated by rebuilds of code that did not change. Do not adopt it for a single-package repository, or if you cannot accept that remote caching, task distribution and self-healing CI are documented as Nx Cloud features rather than parts of the MIT-licensed CLI.
Can I use it commercially?
Yes. MIT is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
Is it still maintained?
Yes. The repository received new commits within the last day.
What is it written in?
Mainly TypeScript, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on September 15, 2026, and from our analysis. They are not legal advice.

DEEP OPEN-SOURCE ANALYSIS

The problem Nx targets: repeated work in a workspace of packages

A repository that holds several packages has a build problem that a single-package repository does not. Change one file in a shared library and the naive pipeline rebuilds and retests everything downstream, whether or not the change touches it. The README frames the answer as caching what did not change and running only what is affected, and the quick start is deliberately short: run npx nx init in any npm, pnpm or yarn workspace. The README states that Nx picks up existing package.json scripts, caches their outputs, and runs only what is affected, with no changes to your setup required. That claim is the whole adoption pitch. You are not asked to restructure your repository before you see any benefit. The audience is therefore narrow and identifiable: teams whose CI already spends minutes on targets that a diff did not touch, and who want incremental behaviour without rewriting their scripts into a new task definition format first.

How the task graph and cache decide what runs

The mechanism is a task graph plus content hashing. Nx reads the targets defined for each project, works out which targets depend on which, and hashes the inputs of each one. Inputs are the files and configuration that a target consumes; outputs are the artefacts it produces. When a hash matches a previous run, the recorded outputs are restored instead of the command being executed again. The README describes the CLI as built with Rust for performance and extensible via TypeScript, so the graph and hashing layer is not the same code path as the plugin logic you write. Plugins are the second half. The README says optional plugins auto-discover tasks, configure cache inputs and outputs, and scaffold code based on your actual tooling, and it names Vite, Webpack, Jest, Vitest, ESLint, Gradle, Maven, .NET and Go among the supported technologies. That is where the polyglot claim comes from: the cache does not care what language a target runs, only what its declared inputs and outputs are. The accuracy of those declarations decides whether the cache is correct, and plugins exist mainly to write them for you.

Getting it running: npx nx init and what to check afterwards

The README gives one command for an existing workspace: npx nx init. It also points to the quickstart docs at nx.dev/docs/quickstart for the full path. The README does not reproduce the contents of nx.json or project.json in the material available here, so the exact schema of those files cannot be confirmed from this source; the documentation site is the place to read them. What the README does establish is the intended sequence. You run init against a workspace that already has package.json scripts, Nx adopts those scripts as targets, and the cache layer is applied to their outputs. The verification step that follows from that description is concrete: after init, list the projects and their targets and compare them against the scripts you had before. If a script is missing from the project graph, it will not be cached and it will not be part of an affected-only run, which quietly removes the benefit for that target. The README also mentions a plugin system that scaffolds code, so a second thing to check is whether init added configuration you did not ask for.

Where the free CLI stops and Nx Cloud begins

This is the boundary that matters most for a build-versus-buy decision, and the README draws it clearly. Remote caching, task distribution across machines, affected-only runs in CI and automatic e2e test splitting are described as things you get by connecting Nx to your CI provider, and the links for those features point at nx.dev/nx-cloud. Self-healing CI, the agent that detects failures, analyses root cause, proposes a fix and verifies it, is likewise an Nx Cloud feature in the README's framing. The repository is MIT-licensed, but the licence covers the code in this repository, not the hosted service. A team can run the CLI and the local cache without paying anything; a team that wants the distributed cache and the CI agent is evaluating a commercial product whose terms are not in this material. Treat the README's badges for hours saved, cache hit rate and self-healing as marketing surfaces rendered from a hosted endpoint, not as measurements you can reproduce locally.

The AI-agent positioning and what it actually changes

The repository description calls Nx a monorepo platform that amplifies both developers and AI agents, and the README devotes a bullet to AI-native tooling, stating that the CLI is optimized for autonomous agents so they get the context they need and can operate like a human, with a link to a separate nx-ai-agents-config repository. There is also the MCP route mentioned alongside self-healing CI, where local agents connect to CI to detect and fix failures. Read that as a distribution argument rather than an architectural one. An agent that can query the project graph and run a single cached target is more useful than one that shells out to a full build, and the task graph is what makes the narrow query possible. But the README does not specify which commands the agent configuration exposes or how the MCP connection is authenticated, so the practical value of this bullet cannot be assessed from the material here. If agent-driven CI is your reason for choosing Nx, that is the part to read in the docs before deciding.

A real alternative, and the difference in approach

Turborepo is the closest comparison for a JavaScript and TypeScript workspace, and the difference is in where the configuration lives. Turborepo keeps the task pipeline in a single turbo.json at the repository root, so the graph is described in one place and the tool is comparatively small. Nx pushes task definitions down to per-project configuration and layers a plugin system on top, which is why it can auto-discover targets for Gradle, Maven, .NET and Go as well as for Vite and Jest. The trade is real in both directions. A single root pipeline file is easier to read and easier to keep consistent; per-project configuration scales to heterogeneous repositories where a Java module and a React app have nothing in common, at the cost of more files and more places for an input declaration to be wrong. Nx also bundles generators, executors and an integrated CI story, so the surface area is larger. If your repository is one language and one build tool, the smaller tool is usually the better fit. If it is genuinely polyglot, the plugin layer is doing work that a root pipeline file would have to hand-roll.

Maintenance cost, release cadence and licence

The release list shows three lines moving at once: 23.2.1 and 22.7.11 published within half an hour of each other on the same day, plus a 23.3.0-beta.0 two days earlier. That is a project that maintains a current minor line, a previous major line and an active beta simultaneously. The practical consequence is that upgrades are a recurring task rather than an annual one, and the cost is not the version bump itself but the plugin and configuration drift that accumulates around it. The repository is MIT-licensed, which is permissive and imposes no copyleft obligation on your own code. That statement is about the licence identifier only; it says nothing about the Nx Cloud service terms, which are separate and are not described in this material. If your organisation has rules about hosted build services, the licence file will not answer them.

Editorial conclusion

Adopt Nx when you already have several packages in one npm, pnpm or yarn workspace and CI time is dominated by rebuilds of code that did not change. Do not adopt it for a single-package repository, or if you cannot accept that remote caching, task distribution and self-healing CI are documented as Nx Cloud features rather than parts of the MIT-licensed CLI. Before committing, run npx nx init on a branch and confirm two things: that nx show project <name> lists every target your package.json scripts previously provided, and that a second run of the same target reports a cache hit rather than re-executing.

Official sources

  1. License: MIT
  2. nrwl/nx on GitHub
  3. Project website
  4. README
  5. Releases
Community notes

Community notes