Carlos Cifuentes
Glossary

Nx

Nx is an open source build system for monorepos that understands project dependencies, runs tasks only where needed and caches their results.

Nx manages a workspace with many projects. It analyzes imports and configuration to build a project graph, and it uses that graph for everything else. It started in the Angular community and now supports React, Node and other stacks through plugins.

Its main capabilities:

  • Affected commands: run build, test or lint only for the projects touched by a change.
  • Caching: skip a task whose inputs have not changed, locally or through a shared remote cache.
  • Generators: create applications, libraries and components with a consistent structure.
  • Module boundary rules: a lint rule that restricts which projects may import which, based on tags.

Example

nx affected -t lint test build

In a workspace with a shell and six remotes, a pull request that changes only the invoices remote runs these three tasks for that remote and for anything that depends on it. The other projects are skipped or restored from cache.

Common misunderstanding

Nx is sometimes seen as an Angular-only tool, or as a framework that takes over the project. It is a layer on top of the existing build tools. The Angular builders, Vite or Jest still do the actual work, and Nx decides what to run and when.

Nx also does not design the architecture for you. The graph and the boundary rule only help if the workspace is divided into libraries with clear responsibilities, and if tags are defined and enforced. A workspace with one giant shared library gets little benefit, because every change affects everything. Start from the boundaries you want between teams and encode them as tags. See micro-frontends for a platform layout.

Why it matters. It keeps CI fast when a shell, many remotes and shared libraries live in one repository, and its boundary rules stop new code from importing legacy code in ways that would block the migration.

Related terms

Planning a migration or a micro-frontend platform?

In a 20-minute call you describe your situation and I tell you how I'd approach it. If it isn't worth doing yet, I'll say so.

Message me on LinkedIn