Skip to content

Nx

Nx is the build system and monorepo orchestration tool that manages the petfolio-fe workspace. It coordinates builds, tests, and linting across all projects, and enforces architectural boundaries between them.

Why Nx?

A monorepo without tooling quickly becomes slow and hard to maintain. Nx solves this by:

  • Dependency graph awareness: Nx understands which projects depend on which, so it can determine the minimum set of work needed when code changes.
  • Computation caching: build, test, and lint results are cached locally. If nothing relevant has changed, Nx skips the work entirely.
  • Parallel task execution: independent tasks run in parallel across available CPU cores, reducing overall pipeline time.
  • Module boundary enforcement: ESLint rules powered by Nx prevent libraries from importing things they should not, keeping the architecture clean.

Common commands

# Build all projects
npx nx run-many -t build

# Test all projects
npx nx run-many -t test

# Lint all projects
npx nx run-many -t lint

# Build a single project
npx nx build petfolio-business

# Show the interactive dependency graph
npx nx graph

In this section