This guide walks you through creating a new Nx workspace, running tasks, and experiencing the two features that make Nx essential for monorepos: local caching and affected commands.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/nrwl/nx/llms.txt
Use this file to discover all available pages before exploring further.
Create a new workspace
Run the following command to scaffold a new Nx workspace:The interactive prompt asks for:After the command completes, you’ll have a workspace directory containing:
- Workspace name — the name of your root directory
- Starter template — choose from React, Angular, Node, and more
Run a task
Move into your workspace directory and run a task on one of your projects:Nx reads the
build target from myapp’s project configuration or package.json scripts, resolves the correct task pipeline (including any dependencies that must build first), and runs the task.You’ll see terminal output as the build runs, along with how long it took.See caching in action
Run the exact same command a second time:This time you’ll see:Nx computes a hash of your source files, environment variables, and task configuration. When the hash matches a previous run, it restores the outputs from cache instantly — no rebuilding required.
Run tasks across all projects
Run a target across every project in your workspace with Nx resolves the task dependency graph, runs tasks in the right order, parallelizes where it can, and applies caching to every individual task. Projects whose outputs haven’t changed get instant cache hits.
run-many:Run only affected tasks
When working in a branch, you usually only want to test and build what your changes could have broken. Use the Nx compares your current branch against the base branch (
affected command:main by default), computes which projects are affected by the changed files using the project graph, and runs the specified targets only on those projects.This dramatically reduces CI time as your monorepo grows.Next steps
Configure task caching
Control what gets cached, set cache inputs and outputs, and enable remote caching.
Add Nx plugins
Add plugins for your tech stack to get auto-configured tasks, code generation, and more.
Set up CI
Connect Nx to GitHub Actions, GitLab, Azure, or any other CI provider.
AI integration
Give AI coding assistants real context about your workspace with the Nx MCP server.
