Nx is a smart monorepo build system that amplifies developer productivity through intelligent caching, distributed task execution, and code generation. Built for managing large-scale codebases with multiple applications and libraries, Nx provides robust tooling for React, Angular, Node.js, and other frameworks. What sets Nx apart is its computation caching and affected command analysis — features that drastically reduce build times by only rebuilding what changed, making it indispensable for teams working with interconnected projects where one change shouldn't trigger a full workspace rebuild.
What This Cheat Sheet Covers
This topic spans 12 focused tables and 84 indexed concepts. Below is a complete table-by-table outline of this topic, spanning foundational concepts through advanced details.
Table 1: Core CLI Commands
These are the commands you'll type every day. The standouts are nx affected and nx run-many — they're how you run tasks across a sprawling workspace without touching projects that didn't change — while nx graph, nx reset, and nx migrate cover visualizing dependencies, clearing a misbehaving cache, and staying current with breaking changes.
| Command | Example | Description |
|---|---|---|
nx run my-app:buildnx run my-lib:test | • Executes a specific target for a project • targets include build, test, serve, lint, and custom executors defined in project configuration | |
nx affected -t build testnx affected -t lint --base=main | • Runs tasks only on projects affected by code changes • compares current branch against a base to determine dependency impact and minimize CI time | |
nx run-many -t build --allnx run-many -t test --projects=tag:api | • Executes tasks across multiple projects in parallel • supports filtering by tags, project names, or glob patterns with configurable parallelism limits | |
nx graphnx graph --affected | Opens interactive dependency graph visualization showing relationships between projects, tasks, and affected scope after code changes. | |
nx migrate latestnx migrate --run-migrations | Generates migration plan for updating Nx and workspace dependencies, then applies automated code transformations to adapt to breaking changes. |