# dyani101/asiphe-fe-assessment architecture

> Architecture diagram of the GitHub repository dyani101/asiphe-fe-assessment, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-06-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/dyani101/asiphe-fe-assessment
- Repository: https://github.com/dyani101/asiphe-fe-assessment

## Overview

##### Project Type and Purpose
- This is a single-page front-end application built with Angular (v14) generated by Angular CLI.
- It manages “customers” and “quotes” (spelled “qoutes” in code), exposing UI for listing, details, dialogs, and forms.
- It uses NgRx (store/actions/reducers/effects) for state management and local JSON files as data sources (assets/customers.json, assets/qoutes.json).

##### High-Level File Structure Analysis
- src/app
– app.module.ts, app-routing.module.ts: the root module and routing configuration.
– components/: feature modular components for customer and quote management (with their own modules, routing, views, styles, and specs).
– services/: HTTP/data services (QouteService) handling data fetch.
– store/: NgRx state management separated into customer and quote domains (actions, reducers, effects, selectors, state).
– models/: TypeScript interfaces/models for Customer and Quote.
- src/assets: local JSON data to simulate backend (customers.json, qoutes.json).
- environments/: environment.ts/prod: base URLs or flags (if real backend were used).

##### Core Components and Interactions
a. UI Layer (Components)
– CustomerManagementModule + QuoteManagementModule
– CustomerDetailComponent, dialogs (ConfirmDialog, CustomerDialog)
b. State Layer (NgRx Store)
– CustomerStore: customer.actions → customer.effects → service → customer.reducer → customer.selectors
– QuoteStore: analogous flow
c. Services Layer
– QouteService: fetches JSON from assets or calls HTTP API
d. Data Layer (Assets/Backend)
– Local JSON files or external REST endpoints
e. Angular Core
– Router: navigates between customer and quote views
– HttpClientModule: injected into services

##### Architectural Patterns and Design Principles
- Separation of Concerns: UI vs State vs Data Services.
- Redux Pattern via NgRx: unidirectional data flow (Actions → Effects → Reducers → Selectors → UI).
- Feature Modules: lazy-loadable modules for customer and quote management.
- Component-Based UI: small reusable components and dialogs.
- Environment-based configuration (prod vs dev).

##### What
- State Management (grouped): CustomerActions, CustomerEffects, CustomerReducer, CustomerSelectors; similarly for Quote.
- Services: QouteService (and any future CustomerService).
- Data Source: assets/customers.json & assets/qoutes.json or backend API.
– UI Components → dispatch Actions → Store
– Actions → Effects → Service calls → Data Source → Effects dispatch Success/Failure Actions
– Reducers update State → Selectors feed data back to Components
– Router directs navigation between feature modules
– Blue rectangles for UI components
– Yellow parallelograms for services
– Gray database symbols for JSON/REST data

## Diagram (Mermaid)

```mermaid
graph TB
  subgraph "Browser: Angular App (src/main.ts → app.module.ts)"
    subgraph "UI / Components"
      AppComponent["AppComponent"]:::ui
      subgraph "Customer Module"
        CustMgmtMod["CustomerManagementModule"]:::module
        CustomerComp["CustomerManagementComponent"]:::ui
        CustDetail["CustomerDetailComponent"]:::ui
        ConfirmDialog["ConfirmDialog"]:::ui
        CustDialog["CustomerDialog"]:::ui
      end
      subgraph "Quote Module"
        QuoteMgmtMod["QouteManagementModule"]:::module
        QuoteComp["QouteManagementComponent"]:::ui
      end
    end

    subgraph "Router"
      Router["Router"]:::router
    end

    subgraph "State / NgRx Store"
      subgraph "Customer Store"
        CustActions["CustomerActions"]:::store
        CustEffects["CustomerEffects"]:::store
        CustReducer["CustomerReducer"]:::store
        CustSelectors["CustomerSelectors"]:::store
      end
      subgraph "Quote Store"
        QuoteActions["QouteActions"]:::store
        QuoteEffects["QouteEffects"]:::store
        QuoteReducer["QouteReducer"]:::store
        QuoteSelectors["QouteSelectors"]:::store
      end
    end

    subgraph "Services & Data"
      QuoteService["QouteService"]:::service
      CustomerService["CustomerService"]:::service
      CustomersJSON["customers.json"]:::data
      QuotesJSON["qoutes.json"]:::data
    end
  end

  %% Router navigation
  AppComponent -->|"/customers"| CustMgmtMod
  AppComponent -->|"/quotes"| QuoteMgmtMod
  CustMgmtMod -->|renders| CustomerComp
  QuoteMgmtMod -->|renders| QuoteComp

  %% Customer flow
  CustomerComp -->|dispatch AddCustomer| CustActions
  CustActions -->|listen| CustEffects
  CustEffects -->|calls HTTP GET| CustomerService
  CustomerService -->|reads| CustomersJSON
  CustomersJSON -->|returns data| CustEffects
  CustEffects -->|dispatch AddCustomerSuccess| CustReducer
  CustReducer -->|updates state| CustSelectors
  CustSelectors -->|select data| CustomerComp

  CustDetail -->|dispatch LoadCustomerDetail| CustActions
  ConfirmDialog -->|dispatch ConfirmDelete| CustActions
  CustDialog -->|dispatch SaveCustomer| CustActions

  %% Quote flow
  QuoteComp -->|dispatch AddQoute| QuoteActions
  QuoteActions -->|listen| QuoteEffects
  QuoteEffects -->|calls HTTP GET| QuoteService
  QuoteService -->|reads| QuotesJSON
  QuotesJSON -->|returns data| QuoteEffects
  QuoteEffects -->|dispatch AddQouteSuccess| QuoteReducer
  QuoteReducer -->|updates state| QuoteSelectors
  QuoteSelectors -->|select data| QuoteComp

  %% Classes and styles
  classDef ui fill:#D0E8FF,stroke:#026AA7,color:#000;
  classDef module fill:#E8F5D0,stroke:#4B8B3B,color:#000;
  classDef router fill:#F3D1FF,stroke:#7E3F98,color:#000;
  classDef store fill:#DFF5D0,stroke:#3F8B37,color:#000;
  classDef service fill:#FFF5C2,stroke:#D7A600,color:#000;
  classDef data fill:#E0E0E0,stroke:#606060,color:#000;

  %% Click Events
  click AppComponent "https://github.com/dyani101/asiphe-fe-assessment/blob/main/src/app/app.module.ts"
  click CustMgmtMod "https://github.com/dyani101/asiphe-fe-assessment/blob/main/src/app/components/customer-management/customer-management.module.ts"
  click CustomerComp "https://github.com/dyani101/asiphe-fe-assessment/blob/main/src/app/components/customer-management/customer-management.component.ts"
  click CustDetail "https://github.com/dyani101/asiphe-fe-assessment/blob/main/src/app/components/customer-detail/customer-detail.component.ts"
  click ConfirmDialog "https://github.com/dyani101/asiphe-fe-assessment/blob/main/src/app/components/customer-dialogs/confirm-dialog.component.ts"
  click CustDialog "https://github.com/dyani101/asiphe-fe-assessment/blob/main/src/app/components/customer-dialogs/customer-dialog.component.ts"
  click QuoteMgmtMod "https://github.com/dyani101/asiphe-fe-assessment/blob/main/src/app/components/qoute-management/qoute-management.module.ts"
  click QuoteComp "https://github.com/dyani101/asiphe-fe-assessment/blob/main/src/app/components/qoute-management/qoute-management.component.ts"
  click QuoteService "https://github.com/dyani101/asiphe-fe-assessment/blob/main/src/app/services/qoute.services.ts"
  click CustActions "https://github.com/dyani101/asiphe-fe-assessment/blob/main/src/app/store/customer/customer.actions.ts"
  click CustEffects "https://github.com/dyani101/asiphe-fe-assessment/blob/main/src/app/store/customer/customer.effects.ts"
  click CustReducer "https://github.com/dyani101/asiphe-fe-assessment/blob/main/src/app/store/customer/customer.reducer.ts"
  click CustSelectors "https://github.com/dyani101/asiphe-fe-assessment/blob/main/src/app/store/customer/customer.selectors.ts"
  click QuoteActions "https://github.com/dyani101/asiphe-fe-assessment/blob/main/src/app/store/qoute/qoute.actions.ts"
  click QuoteEffects "https://github.com/dyani101/asiphe-fe-assessment/blob/main/src/app/store/qoute/qoute.effects.ts"
  click QuoteReducer "https://github.com/dyani101/asiphe-fe-assessment/blob/main/src/app/store/qoute/qoute.reducer.ts"
  click QuoteSelectors "https://github.com/dyani101/asiphe-fe-assessment/blob/main/src/app/store/qoute/qoute.selector.ts"
  click CustomersJSON "https://github.com/dyani101/asiphe-fe-assessment/blob/main/src/assets/customers.json"
  click QuotesJSON "https://github.com/dyani101/asiphe-fe-assessment/blob/main/src/assets/qoutes.json"
  click Router "https://github.com/dyani101/asiphe-fe-assessment/blob/main/src/app/app-routing.module.ts"
```
