# iamkarthickselvam/vehicleinsuranceclient architecture

> Architecture diagram of the GitHub repository iamkarthickselvam/vehicleinsuranceclient, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-21). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/iamkarthickselvam/vehicleinsuranceclient
- Repository: https://github.com/iamkarthickselvam/vehicleinsuranceclient

## Overview

##### Project type and purpose
- This is a single‐page frontend client built with Angular v16 and Bootstrap.
- Purpose: allow users to purchase vehicle insurance by selecting vehicle type, insurance plan, entering personal details, and completing payment. It fetches data and submits orders via an external RESTful Vehicle Insurance API and retrieves invoice PDFs.

##### File structure
- Top‐level files: angular.json, package.json, tsconfig.json, README.md, staticwebapp.config.json.
- src/ contains the SPA:
- src/app/_models – TypeScript interfaces (Vehicle, Image, Comp)
- src/app/_services – VehicleService wrapping HttpClient calls to the API and managing state via RxJS BehaviorSubject & sessionStorage
- src/app/app-routing.module.ts – Angular Router setup
- src/app/components: home, nav-bar, car-details, success, vehicle-details (with child modules: details, personal, plan, addon, checkout)
- src/assets – static images
- src/index.html, src/main.ts – app bootstrap
- CI/CD: .github/workflows/azure-static-web-apps-*.yml for deploying to Azure Static Web Apps.

##### README for additional insights
- Confirms Angular, RxJS, HttpClient usage, template‐driven & reactive forms, and deployment target (Azure Static Web App).
- Mentions interaction with Vehicle Insurance API (external service).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Deployment Pipeline
    GHA[/"GitHub Actions CI/CD"/]:::deployment
    AZ["Azure Static Web App"]:::deployment

    GHA -->|"deploys to"| AZ

    %% Browser UI Layer
    subgraph "UI Layer" 
        direction TB
        NB["NavBarComponent"]:::frontend
        HOME["HomeComponent"]:::frontend
        CD["CarDetailsComponent"]:::frontend
        subgraph "VehicleDetails Module"
            direction TB
            VD["VehicleDetailsComponent"]:::frontend
            DET["DetailsComponent"]:::frontend
            PLN["PlanComponent"]:::frontend
            PER["PersonalComponent"]:::frontend
            AD["AddonComponent"]:::frontend
            CHK["CheckoutComponent"]:::frontend
        end
        SUC["SuccessComponent"]:::frontend
        ROUTER["Angular Router"]:::frontend
    end

    %% Service & Data Layer
    VS["VehicleService"]:::service
    DB[(SessionStorage)]:::storage
    API["Vehicle Insurance API"]:::external

    %% Bootstrap & Models
    subgraph "App Bootstrap & Models"
        direction TB
        MAIN["main.ts"]:::frontend
        INDEX["index.html"]:::frontend
        STYLES["styles.css"]:::frontend
        APPMOD["app.module.ts"]:::frontend
        APCOMP["app.component.ts"]:::frontend
        VEHICLE_MODEL["vehicle.ts"]:::service
        IMAGE_MODEL["image.ts"]:::service
        COMP_MODEL["comp.ts"]:::service
        ROUTING["app-routing.module.ts"]:::frontend
    end

    %% Config Files
    subgraph "Configuration"
        staticweb_root["staticwebapp.config.json (root)"]:::deployment
        staticweb_src["src/staticwebapp.config.json"]:::deployment
    end

    %% Interactions
    HOME -->|clicks links| ROUTER
    NB -->|navigates| ROUTER
    CD -->|requests data| ROUTER
    ROUTER -->|renders| HOME
    ROUTER -->|renders| CD
    ROUTER -->|renders| VD
    ROUTER -->|renders| SUC

    HOME -->|"calls UI methods"| VS
    CD -->|"calls UI methods"| VS
    VD -->|"calls UI methods"| VS
    SUC -->|"calls UI methods"| VS

    VS -->|"HTTP GET/POST"| API
    API -->|"JSON/PDF blob"| VS

    VS -->|"stores state"| DB
    VS -->|"reads state"| DB

    VS -->|"updates Observables"| HOME
    VS -->|"updates Observables"| CD
    VS -->|"updates Observables"| VD
    VS -->|"updates Observables"| SUC

    %% Click Events for Components
    click HOME "https://github.com/iamkarthickselvam/vehicleinsuranceclient/blob/main/src/app/home/home.component.ts"
    click NB "https://github.com/iamkarthickselvam/vehicleinsuranceclient/blob/main/src/app/nav-bar/nav-bar.component.ts"
    click CD "https://github.com/iamkarthickselvam/vehicleinsuranceclient/blob/main/src/app/car-details/car-details.component.ts"
    click VD "https://github.com/iamkarthickselvam/vehicleinsuranceclient/blob/main/src/app/vehicle-details/vehicle-details.component.ts"
    click DET "https://github.com/iamkarthickselvam/vehicleinsuranceclient/blob/main/src/app/vehicle-details/details/details.component.ts"
    click PLN "https://github.com/iamkarthickselvam/vehicleinsuranceclient/blob/main/src/app/vehicle-details/plan/plan.component.ts"
    click PER "https://github.com/iamkarthickselvam/vehicleinsuranceclient/blob/main/src/app/vehicle-details/personal/personal.component.ts"
    click AD "https://github.com/iamkarthickselvam/vehicleinsuranceclient/blob/main/src/app/vehicle-details/addon/addon.component.ts"
    click CHK "https://github.com/iamkarthickselvam/vehicleinsuranceclient/blob/main/src/app/vehicle-details/checkout/checkout.component.ts"
    click SUC "https://github.com/iamkarthickselvam/vehicleinsuranceclient/blob/main/src/app/success/success.component.ts"
    click VS "https://github.com/iamkarthickselvam/vehicleinsuranceclient/blob/main/src/app/_services/vehicle.service.ts"
    click VEHICLE_MODEL "https://github.com/iamkarthickselvam/vehicleinsuranceclient/blob/main/src/app/_models/vehicle.ts"
    click IMAGE_MODEL "https://github.com/iamkarthickselvam/vehicleinsuranceclient/blob/main/src/app/_models/image.ts"
    click COMP_MODEL "https://github.com/iamkarthickselvam/vehicleinsuranceclient/blob/main/src/app/_models/comp.ts"
    click MAIN "https://github.com/iamkarthickselvam/vehicleinsuranceclient/blob/main/src/main.ts"
    click INDEX "https://github.com/iamkarthickselvam/vehicleinsuranceclient/blob/main/src/index.html"
    click STYLES "https://github.com/iamkarthickselvam/vehicleinsuranceclient/blob/main/src/styles.css"
    click APPMOD "https://github.com/iamkarthickselvam/vehicleinsuranceclient/blob/main/src/app/app.module.ts"
    click APCOMP "https://github.com/iamkarthickselvam/vehicleinsuranceclient/blob/main/src/app/app.component.ts"
    click ROUTING "https://github.com/iamkarthickselvam/vehicleinsuranceclient/blob/main/src/app/app-routing.module.ts"
    click staticweb_root "https://github.com/iamkarthickselvam/vehicleinsuranceclient/blob/main/staticwebapp.config.json"
    click staticweb_src "https://github.com/iamkarthickselvam/vehicleinsuranceclient/blob/main/src/staticwebapp.config.json"

    %% Styles
    classDef frontend fill:#ADD8E6,stroke:#333,stroke-width:1px
    classDef service fill:#90EE90,stroke:#333,stroke-width:1px
    classDef storage fill:#D3D3D3,stroke:#333,stroke-width:1px
    classDef external fill:#FFA500,stroke:#333,stroke-width:1px
    classDef deployment fill:#D8BFD8,stroke:#333,stroke-width:1px
```
