Skip to main content

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.

Nx core functionality focuses on task running and understanding your project and task graph. Nx plugins build on that foundation to enforce best practices, integrate tooling, and let developers get up and running quickly. As your repository grows, you’ll find more reasons to create your own extensions:
  • Standardize workflows — local generators automate repetitive scaffolding so every team member follows the same patterns.
  • Eliminate duplicate config — local executors wrap tool invocations once and share them across every project.
  • Scale across repos — publishable plugins let you share generators, executors, and inferred task logic with multiple monorepos or with the wider community.

Three ways to extend Nx

Local generators

Automate code scaffolding, enforce project structure, and standardize workflows within a single workspace.

Local executors

Wrap build, test, and deployment scripts in a consistent interface with schema validation and caching support.

Create a plugin

Package generators and executors into a publishable plugin that integrates a tool or framework and can be shared across repos.

When to use each approach

SituationRecommended approach
Automate a repetitive task in one repoLocal generator
Standardize a build or test script in one repoLocal executor
Infer tasks from a config file automaticallyPlugin with createNodesV2
Share logic across multiple monoreposPublishable plugin
Integrate a framework for the communityPublishable plugin

The @nx/devkit API

All plugin development uses the @nx/devkit package, which provides the building blocks for generators and executors.
import {
  Tree,                       // Virtual file system
  generateFiles,              // Create files from EJS templates
  formatFiles,                // Format files with Prettier
  addProjectConfiguration,    // Register a new project
  readProjectConfiguration,   // Read an existing project's config
  updateProjectConfiguration, // Modify an existing project's config
  readNxJson,                 // Read nx.json
  updateNxJson,               // Write nx.json
  updateJson,                 // Modify any JSON file
  installPackagesTask,        // Trigger package installation after generation
  names,                      // Derive camelCase/PascalCase/kebab-case names
  joinPathFragments,          // Join path segments safely
} from '@nx/devkit';

Create your first plugin

1

Add the plugin package

npx nx add @nx/plugin
2

Scaffold a plugin in your workspace

npx nx g @nx/plugin:plugin tools/my-plugin
Or create a brand-new workspace with a plugin already set up:
npx create-nx-plugin my-plugin
3

Add generators and executors

# Add a generator
npx nx g @nx/plugin:generator tools/my-plugin/src/generators/my-generator

# Add an executor
npx nx g @nx/plugin:executor tools/my-plugin/src/executors/my-executor

Explore further

Local generators

Create and run generators inside your workspace.

Local executors

Write custom task runners with schema validation.

Create a plugin

Package everything into a publishable Nx plugin.

Project graph plugins

Add nodes and dependencies to the Nx project graph.