Skip to content

Angular is a framework for building web applications. Nx has first party support for Angular projects. If you're familiar with the Angular CLI, ng, then Nx CLI will feel very familiar. The @nx/angular plugin adds generators, Angular CLI builder integration (executors) and migrations so you can run Angular tasks through Nx. With Nx, each project has its own configuration instead of a single angular.json file, making it more scalable for monorepos. You can use Angular with Nx without the plugin and still get task caching, task orchestration, and the project graph.

See the Nx and Angular versions matrix to know which Nx version supports a given Angular version.

Terminal window
nx add @nx/angular

Verify the plugin is active by inspecting an Angular project:

Terminal window
nx show project <your-app-name>

Look for build, serve, test, lint, or e2e targets generated from angular.json.

Terminal window
npx create-nx-workspace my-org --template=nrwl/angular-template
Terminal window
nx g @nx/angular:app apps/my-app

By default, Nx configures ESLint for linting, Jest for unit tests, and Cypress for e2e tests. Read more of the options available for the application generator in the Angular application generators reference.

Terminal window
nx serve my-app
nx build my-app
nx test my-app
nx lint my-app
nx e2e my-app
Terminal window
nx g @nx/angular:lib libs/my-lib

By default, Nx configures ESLint for linting, Jest for unit tests. Read more of the options available for the application generator in the angular library generators reference.

There are also generators for setting up common items inside your projects, such as components and services:

Terminal window
nx g @nx/angular:component libs/my-lib/src/lib/my-component
nx g @nx/angular:service libs/my-lib/src/lib/my-service
Terminal window
nx test my-lib
nx lint my-lib

If you need libraries that build or publish, generate them with build output enabled and an import path. This creates build targets you can cache and run in CI. See Set up incremental builds for Angular libraries for details.

Terminal window
nx g @nx/angular:lib libs/my-lib

Nx includes generators for scaffolding Module Federation architectures with Angular. Generate a host application and its remotes in one command:

Terminal window
nx g @nx/angular:host apps/shell --remotes=products,checkout

See all options in the Angular host generators reference.

Add a remote to an existing host:

Terminal window
nx g @nx/angular:remote apps/login --host=shell

See all options in the Angular remote generators reference.

Pass --dynamic for dynamic federation (remotes resolved at runtime) or --ssr for server-side rendering with Module Federation.

Run only what changed using the project graph:

Terminal window
nx affected -t build test lint e2e

Enable remote caching for faster CI runs:

Terminal window
nx connect

If you use Angular CLI configurations, define a ci configuration in angular.json and run tasks with --configuration=ci for CI-specific settings.

See Set Up CI for a sample CI setup.