Skip to main content
The @nx/node plugin adds Node.js support to your Nx workspace. It provides generators for scaffolding Node applications and libraries, with built-in support for popular frameworks like Express, Fastify, and NestJS. Applications can be built with esbuild or webpack.

Installation

Or install manually:

What the plugin provides

Generators

Scaffold Node.js applications, libraries, and Docker configurations.

Framework support

Generate Express, Fastify, and NestJS applications with optional framework boilerplate.

Docker integration

Add Docker configuration to any Node.js project with the setup-docker generator.

Generators

application

Create a new Node.js application.
Specify a framework:
Choose a bundler:

library

Create a Node.js library that can be shared across your workspace.
Create a publishable library:

setup-docker

Add a Dockerfile and Docker Compose configuration to an existing Node.js project.
This creates a production-ready Dockerfile that:
  • Uses a multi-stage build to keep the final image small
  • Copies only the built output and required node_modules
  • Runs the application as a non-root user

Inferred tasks

@nx/node delegates build and serve targets to @nx/js, @nx/esbuild, and @nx/webpack depending on the chosen bundler. Tasks are inferred from the build tool’s configuration file when the corresponding plugin is registered in nx.json.
When you generate a Node application, Nx automatically configures the appropriate bundler plugin so that build, serve, and test tasks are available without manual configuration.

Configuration examples

project.json for an Express app (esbuild)

Docker setup

After running setup-docker, serve the application in a container:

Running tasks

Working with NestJS

For full NestJS support, use @nx/nest which extends @nx/node with NestJS-specific generators for modules, controllers, services, guards, pipes, and interceptors.