Section 2 of 17

Where the idea comes from

Contents

The architecture combines three sources. We name them because each one is worth reading in the original.

Source What it contributes
Nx (the Nrwl team, Enterprise Angular Monorepo Patterns) The monorepo itself, libraries with a public index.ts, and the classic library types: feature, ui, data-access, util. Tags on projects and the @nx/enforce-module-boundaries lint rule.
Manfred Steyer (ANGULARarchitects, the e-book Enterprise Angular, his articles on strategic design with Nx) Applying Domain-Driven Design to front-ends: domains as vertical slices, library types as horizontal layers, two tag dimensions (domain:* and type:*) checked by a linter, an API library as the only door between domains, and a facade between the UI and the state management. Later also Sheriff, a boundary checker for projects without Nx.
NgRx (and Redux before it) One store for shared state, changes through actions and pure reducers, side effects in effects, reads through memoized selectors.

What we decided on top, in this guide:

  • a separate model type for framework-free types and pure domain functions, so that ui libraries never depend on state management;
  • a shell type of its own (Nx's feature-shell) that owns a domain's routes and providers;
  • a third tag dimension, framework:*, so Angular, React and Vue applications can live in one workspace and share model and util code;
  • a fourth dimension for Next.js, platform:server and platform:client;
  • the rule of section 10 for when a facade pays off and when to skip it;
  • the React/Next and Vue/Nuxt translations in sections 12 and 13.

When something on this page disagrees with the original articles, the original is the reference for the idea; this page is the reference for how we apply it.