--- type: doc name: architecture description: System architecture, layers, patterns, and design decisions category: architecture generated: 2026-04-29 status: active scaffoldVersion: "2.0.0" --- # Architecture Notes ## System Architecture Overview The system is a modular frontend web application built using Angular. It follows a modular monolith architecture where features are grouped into specific modules such as `Sales`, `Partners`, `Financial`, and `CRM`. The application heavily relies on Redux-pattern state management (likely NgRx) to manage global state such as shopping carts, customer sales, and application data flow. Data is fetched via Angular services which communicate with a backend REST API. ## Architectural Layers - **Components**: UI elements and pages organized by feature domain (`src/app/sales/`, `src/app/partners/`, `src/app/crm/`). - **Services**: Business logic and API communication layer (`src/app/services/`, `src/app/shared/services/`). - **Store / State Management**: Reducers, actions, and models handling complex state management (`src/app/sales/store/`). - **Models**: TypeScript interfaces and classes defining data structures (`src/app/models/`). - **Shared Utils**: Common messages, loading indicators, and validators (`src/app/shared/`). > See [`codebase-map.json`](./codebase-map.json) for complete symbol counts and dependency graphs. ## Detected Design Patterns | Pattern | Confidence | Locations | Description | |---------|------------|-----------|-------------| | Module | 100% | `src/app/*.module.ts` | Angular feature modules for separation of concerns | | Redux / Store | 95% | `src/app/sales/store/` | State management using Actions, Reducers, and Store | | Dependency Injection | 100% | `src/app/services/` | Angular DI for injecting services into components | | Observable / Reactive | 90% | Services & Store | Heavy use of RxJS Observables for async data flows | ## Entry Points - [AppModule](file:///d:/desenvolvimento/Simplifique/vendaweb/Vendaweb-portal/src/app/app.module.ts) - [AppComponent](file:///d:/desenvolvimento/Simplifique/vendaweb/Vendaweb-portal/src/app/app.component.ts) ## Public API | Symbol | Type | Location | |--------|------|----------| | `AppModule` | Class | `src/app/app.module.ts` | | `SalesModule` | Class | `src/app/sales/sales.module.ts` | | `PartnersModule` | Class | `src/app/partners/partners.module.ts` | | `ShoppingReducer` | Function | `src/app/sales/store/reducers/shopping.reducer.ts` | ## Internal System Boundaries The application is clearly separated into bounded contexts: - **Sales**: Core module handling product listings, shopping carts, checkout, and ordering. - **Partners**: Module for managing partner ranges, reports, and payments. - **CRM**: Module handling customer data, editing, and listing. - **Admin/Auth**: Authentication and user permission management. ## Top Directories Snapshot - `src/app/sales/` (~50+ files) - `src/app/models/` (~40+ files) - `src/app/shared/` (~30+ files) - `src/app/partners/` (~20+ files) - `src/app/components/` (~10+ files) ## Related Resources - [Project Overview](./project-overview.md) - [Data Flow](./data-flow.md)