Project based on principle Feature-based Architecture: each feature owns its UI, routes, models, mappers, services, and store when needed. Shared and core code live outside features.
π¦ src/
βββ π app/
β βββ π features/ # Feature modules
β β βββ π feature-name/
β β βββ π components/ # Feature UI pieces
β β βββ π pages/ # Route-level pages (when used)
β β βββ π models/ # Feature-local *.model.ts types
β β βββ π mappers/ # Feature API β domain mappers
β β βββ π services/ # Feature HTTP / facade services
β β βββ π store/ # Feature NGXS state (actions, model, state, selectors)
β β βββ π enums/ # Feature enums
β β βββ π constants/ # Feature constants
β β βββ feature.routes.ts # Feature routes
β β βββ feature.component.ts # Feature shell / entry component
β β
β βββ π core/ # App-wide infrastructure
β β βββ π components/ # Shell UI (header, banners, β¦)
β β βββ π services/ # Global services
β β βββ π store/ # Core NGXS state (user, emails, β¦)
β β βββ π models/ # Core config / routing types
β β βββ π guards/
β β βββ π interceptors/
β β βββ π helpers/
β β βββ π provider/
β β
β βββ π shared/ # Cross-feature reusable code
β β βββ π components/ # Shared UI
β β βββ π directives/
β β βββ π pipes/
β β βββ π services/ # Shared HTTP / helpers
β β βββ π stores/ # Shared NGXS domains
β β βββ π models/ # Shared domain + JSON:API models
β β βββ π mappers/ # Shared mappers
β β βββ π enums/
β β βββ π guards/
β β βββ π helpers/
β β
β βββ app.component.ts
β βββ app.config.ts
β βββ app.config.server.ts # SSR app config
β βββ app.routes.ts
β βββ app.routes.server.ts # SSR routes
β
βββ π assets/
βββ π environments/
βββ π styles/
βββ π testing/ # Test helpers, mocks, builders (@testing/*)
βββ main.ts # Browser bootstrap
βββ main.server.ts # SSR bootstrap
βββ server.ts # Express / SSR server entry
βββ index.html- Types live in
*.model.tsfiles (interfaces/types, not classes). - Shared catalog:
shared/models/<domain>/with optional*-json-api.model.tstwins. - Feature-local types:
features/<feature>/models/. - Mappers convert JSON:API β domain at the service boundary.
See Models Conventions.
- Shared domains:
shared/stores/<domain>/ - Feature domains:
features/<feature>/store/ - Core domains:
core/store/
Use Angular CLI for scaffolding:
ng generate component feature-name/components/new-component| Entity | Command |
|---|---|
| π Service | ng g s feature-name/services/new-service |
| π Guard | ng g g feature-name/guards/auth-guard |
| π Pipe | ng g p shared/pipes/currency-format |
| β¨ Directive | ng g d shared/directives/highlight |