Project based on principle Feature-based Architecture, this approach provides reusable and consistant features across the application.
π¦ src/
βββ π features/ # ΠΠ°ΡΠ°Π»ΠΎΠ³ ΡΠ· ΡΡΠ½ΠΊΡΡΠΎΠ½Π°Π»ΡΠ½ΠΈΠΌΠΈ ΠΌΠΎΠ΄ΡΠ»ΡΠΌΠΈ
β βββ π feature-name/
β β βββ π feature.component.ts/html/scss # Component with template and styles, and base logic file
β β βββ π feature-service.ts # Service or Facade to provide data for NGXS
β β βββ π feature.store.ts # NGXS Store for feature
β β βββ π feature.entitity.ts # Feature Interface for data, Types, Enums
β β βββ π feature.guards.ts # Guard's for feature routing and permissions
β β βββ π feature.resolvers.ts # Resolvers for data fetching and preloading
β β βββ π feature.utils.ts # Additinal utils for feature (formBuilders, converters, mappers)
β β βββ feature.module.ts # Optional, if standalone
β β βββ feature.routing.ts # Export of standalone components by path
β
βββ π core/ # Base module for global services, components, and state
β βββ π services/ # Global services (API, Auth, LocalStorage)
β βββ π components/ # Global components (Header, Footer, Sidebar)
β βββ π store/ # Core state management (Auth, Settings, Router)
β βββ core.module.ts # Optional, but must have a provider for core.
β
βββ π shared/ # Shared module for common components, directives, pipes, and services
β βββ π ui/ # Shared UI components (Button, Input, Modal), or wrappers for 3rd party
β βββ π directives/ # Shared Directives (ClickOutside, Draggable)
β βββ π pipes/ # Shared Pipes (Filter, Sort, Format)
β βββ π services/ # Services, Facades for shared logic (Http, LocalStorage)
β βββ π store/ # Shared State management (Settings, Theme, Language)
β
βββ app.routes.ts # General Entry point for routing
βββ main.ts # Providers Setup and Bootstrap
βββ package.json # Dependencies and Scripts
---Use Angular CLI to generate new feature components, services, and modules.
ng generate component feature-name/components/new-component
### π Other Schematics:
| **Entity** | **Command** |
|--------------|----------------------------------------------|
| π **Service** | `ng g s feature-name/services/new-service` |
| π¦ **Module** | `ng g m feature-name` |
| π **Guard** | `ng g g feature-name/guards/auth-guard` |
| π **Pipe** | `ng g p shared/pipes/currency-format` |
| β¨ **Directive** | `ng g d shared/directives/highlight` |