# chamodhpasindu/bsdm-frontend architecture

> Architecture diagram of the GitHub repository chamodhpasindu/bsdm-frontend, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-08-19). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/chamodhpasindu/bsdm-frontend
- Repository: https://github.com/chamodhpasindu/bsdm-frontend

## Overview

#### Purpose and runtime
BSMSFrontend is an Angular 16 single-page frontend for a business/sales management workflow. It provides distinct administrator and field-sales experiences, covering inventory, billing, payment collection, delivery tracking, operational records, and notifications. It runs in the browser via Angular CLI; PWA/service-worker assets are configured through `ngsw-config.json` and `src/manifest.webmanifest`.

#### Bootstrap and application shell
The browser bootstraps from `src/main.ts`, rendering the root component declared by `src/app/app.module.ts`. Global route selection is centralized in `src/app/app-routing.module.ts`; `src/app/app.component.ts` is the root host. Environment-specific frontend settings are separated into `src/environment/environment.ts` and `src/environment/environment.prod.ts`.

#### Administrative workspace
The admin feature module and router establish the back-office boundary: `src/app/admin/admin.module.ts`, `src/app/admin/admin-routing.module.ts`, and `src/app/admin/layout/layout.component.ts`. Its dashboard, management, tracking, and audit screens form the operational control plane, including `src/app/admin/dashboard/dashboard.component.ts`, `src/app/admin/employee-management/employee-management.component.ts`, and `src/app/admin/audit-trail/audit-trail.component.ts`.

#### Inventory and fulfillment domain
Inventory is a nested admin module with independent routing in `src/app/admin/inventory-management/inventory-management.module.ts` and `src/app/admin/inventory-management/inventory-management.routing.module.ts`. It separates product catalog, batch/item records, stock movements, returns, and sales-stock views: `src/app/admin/inventory-management/product/product.component.ts`, `src/app/admin/inventory-management/item-batch/item-batch.component.ts`, and `src/app/admin/inventory-management/stock/stock.component.ts`. Vehicle, customer-route, and delivery tracking features connect inventory operations to field fulfillment.

#### Sales workspace and billing flow
The sales module is the field-user boundary, anchored by `src/app/sales/sales.module.ts`, `src/app/sales/sales-routing.module.ts`, and `src/app/sales/layout/layout.component.ts`. Billing is a staged feature module: route/customer selection, product selection, then bill summary, represented by `src/app/sales/bill/bill.module.ts`, `src/app/sales/bill/select-route/select-route.component.ts`, and `src/app/sales/bill/bill-summary/bill-summary.component.ts`. This suggests UI-driven workflow state passed across routed or nested billing screens; no API/service layer is present in the supplied tree.

#### Payment collection flow
Payment is an independently routed sales workflow in `src/app/sales/payment/payment.module.ts` and `src/app/sales/payment/payment-routing.module.ts`. It guides the user through route, customer, and bill selection before payment handling: `src/app/sales/payment/select-route/select-route.component.ts`, `src/app/sales/payment/select-customer/select-customer.component.ts`, and `src/app/sales/payment/select-bill/select-bill.component.ts`. Admin payment screens provide a separate oversight/view boundary at `src/app/admin/payments/payments.component.ts`.

#### Shared presentation and interaction boundary
Reusable chrome differentiates the two user experiences: `src/app/shared/shared.module.ts`, `src/app/shared/admin-header/admin-header.component.ts`, and `src/app/shared/sales-bottom-nav/sales-bottom-nav.component.ts`. Sales bottom sheets encapsulate transient payment summaries, payment actions, and quick menus; their common mechanism is `src/utils/directives/base-bottom-sheet.directive.ts`. Styling, icons, fonts, and dashboard-chart presentation assets remain client-side under `src/styles.scss` and `src/assets/`.

Main entry points: [`src/app/sales/sales.module.ts`](https://github.com/chamodhpasindu/bsdm-frontend/blob/master/src/app/sales/sales.module.ts) (Sales Module), [`src/app/admin/admin.module.ts`](https://github.com/chamodhpasindu/bsdm-frontend/blob/master/src/app/admin/admin.module.ts) (Admin Module), [`src/app/shared/shared.module.ts`](https://github.com/chamodhpasindu/bsdm-frontend/blob/master/src/app/shared/shared.module.ts) (Shared Module), [`src/app/app.module.ts`](https://github.com/chamodhpasindu/bsdm-frontend/blob/master/src/app/app.module.ts) (Root App Module)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_core["Application Core"]
  node_bootstrap(("Browser Bootstrap<br/>Angular entrypoint<br/>[main.ts]"))
  node_app_module["Root App Module<br/>Angular module<br/>[app.module.ts]"]
  node_app_routing["Global Routes<br/>router"]
  node_app_shell["Root App Shell<br/>root component<br/>[app.component.ts]"]
end

subgraph group_admin["Admin Workspace"]
  node_admin_module["Admin Module<br/>feature module<br/>[admin.module.ts]"]
  node_admin_routing["Admin Routes<br/>router"]
  node_admin_layout["Admin Layout<br/>layout component"]
  node_admin_operations["Operational Control Screens<br/>admin screens"]
  node_inventory_module["Inventory Module<br/>nested feature module"]
  node_inventory_routing["Inventory Routes<br/>router"]
  node_inventory_stock["Stock Management<br/>inventory screen<br/>[stock.component.ts]"]
  node_admin_payments["Payment Oversight<br/>admin screen"]
end

subgraph group_sales["Sales Workspace"]
  node_sales_module["Sales Module<br/>feature module<br/>[sales.module.ts]"]
  node_sales_routing["Sales Routes<br/>router"]
  node_sales_layout["Sales Layout<br/>layout component"]
  node_billing["Billing Workflow<br/>staged feature module<br/>[bill.module.ts]"]
  node_bill_route_selection["Billing Route Selection<br/>workflow screen"]
  node_bill_summary["Bill Summary<br/>workflow screen"]
  node_payment_module["Payment Workflow<br/>staged feature module<br/>[payment.module.ts]"]
  node_payment_routing["Payment Routes<br/>router"]
  node_payment_customer["Payment Customer Selection<br/>workflow screen"]
  node_payment_bill["Payment Bill Selection<br/>workflow screen"]
end

subgraph group_shared["Shared UI"]
  node_shared_module["Shared Module<br/>shared UI module<br/>[shared.module.ts]"]
  node_admin_header["Admin Header<br/>shared component"]
  node_sales_nav["Sales Bottom Navigation<br/>shared component"]
  node_bottom_sheet_base["Bottom Sheet Base<br/>interaction directive"]
end

node_bootstrap -->|"bootstraps"| node_app_module
node_app_module -->|"declares"| node_app_shell
node_app_module -->|"registers"| node_app_routing
node_app_routing -->|"routes to"| node_admin_module
node_app_routing -->|"routes to"| node_sales_module
node_admin_module -->|"configures"| node_admin_routing
node_admin_routing -->|"renders"| node_admin_layout
node_admin_layout -->|"hosts"| node_admin_operations
node_admin_module -->|"contains"| node_inventory_module
node_inventory_module -->|"configures"| node_inventory_routing
node_inventory_routing -->|"routes to"| node_inventory_stock
node_admin_layout -->|"hosts"| node_admin_payments
node_sales_module -->|"configures"| node_sales_routing
node_sales_routing -->|"renders"| node_sales_layout
node_sales_module -->|"contains"| node_billing
node_billing -->|"starts with"| node_bill_route_selection
node_bill_route_selection -.->|"workflow state"| node_bill_summary
node_sales_module -->|"contains"| node_payment_module
node_payment_module -->|"configures"| node_payment_routing
node_payment_routing -->|"guides to"| node_payment_customer
node_payment_customer -->|"selects bill"| node_payment_bill
node_admin_module -.->|"uses"| node_shared_module
node_sales_module -.->|"uses"| node_shared_module
node_shared_module -->|"provides"| node_admin_header
node_shared_module -->|"provides"| node_sales_nav
node_sales_nav -.->|"uses"| node_bottom_sheet_base

click node_bootstrap "https://github.com/chamodhpasindu/bsdm-frontend/blob/master/src/main.ts"
click node_app_module "https://github.com/chamodhpasindu/bsdm-frontend/blob/master/src/app/app.module.ts"
click node_app_routing "https://github.com/chamodhpasindu/bsdm-frontend/blob/master/src/app/app-routing.module.ts"
click node_app_shell "https://github.com/chamodhpasindu/bsdm-frontend/blob/master/src/app/app.component.ts"
click node_admin_module "https://github.com/chamodhpasindu/bsdm-frontend/blob/master/src/app/admin/admin.module.ts"
click node_admin_routing "https://github.com/chamodhpasindu/bsdm-frontend/blob/master/src/app/admin/admin-routing.module.ts"
click node_admin_layout "https://github.com/chamodhpasindu/bsdm-frontend/blob/master/src/app/admin/layout/layout.component.ts"
click node_admin_operations "https://github.com/chamodhpasindu/bsdm-frontend/blob/master/src/app/admin/dashboard/dashboard.component.ts"
click node_inventory_module "https://github.com/chamodhpasindu/bsdm-frontend/blob/master/src/app/admin/inventory-management/inventory-management.module.ts"
click node_inventory_routing "https://github.com/chamodhpasindu/bsdm-frontend/blob/master/src/app/admin/inventory-management/inventory-management.routing.module.ts"
click node_inventory_stock "https://github.com/chamodhpasindu/bsdm-frontend/blob/master/src/app/admin/inventory-management/stock/stock.component.ts"
click node_admin_payments "https://github.com/chamodhpasindu/bsdm-frontend/blob/master/src/app/admin/payments/payments.component.ts"
click node_sales_module "https://github.com/chamodhpasindu/bsdm-frontend/blob/master/src/app/sales/sales.module.ts"
click node_sales_routing "https://github.com/chamodhpasindu/bsdm-frontend/blob/master/src/app/sales/sales-routing.module.ts"
click node_sales_layout "https://github.com/chamodhpasindu/bsdm-frontend/blob/master/src/app/sales/layout/layout.component.ts"
click node_billing "https://github.com/chamodhpasindu/bsdm-frontend/blob/master/src/app/sales/bill/bill.module.ts"
click node_bill_route_selection "https://github.com/chamodhpasindu/bsdm-frontend/blob/master/src/app/sales/bill/select-route/select-route.component.ts"
click node_bill_summary "https://github.com/chamodhpasindu/bsdm-frontend/blob/master/src/app/sales/bill/bill-summary/bill-summary.component.ts"
click node_payment_module "https://github.com/chamodhpasindu/bsdm-frontend/blob/master/src/app/sales/payment/payment.module.ts"
click node_payment_routing "https://github.com/chamodhpasindu/bsdm-frontend/blob/master/src/app/sales/payment/payment-routing.module.ts"
click node_payment_customer "https://github.com/chamodhpasindu/bsdm-frontend/blob/master/src/app/sales/payment/select-customer/select-customer.component.ts"
click node_payment_bill "https://github.com/chamodhpasindu/bsdm-frontend/blob/master/src/app/sales/payment/select-bill/select-bill.component.ts"
click node_shared_module "https://github.com/chamodhpasindu/bsdm-frontend/blob/master/src/app/shared/shared.module.ts"
click node_admin_header "https://github.com/chamodhpasindu/bsdm-frontend/blob/master/src/app/shared/admin-header/admin-header.component.ts"
click node_sales_nav "https://github.com/chamodhpasindu/bsdm-frontend/blob/master/src/app/shared/sales-bottom-nav/sales-bottom-nav.component.ts"
click node_bottom_sheet_base "https://github.com/chamodhpasindu/bsdm-frontend/blob/master/src/utils/directives/base-bottom-sheet.directive.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_bootstrap,node_app_module,node_app_routing,node_app_shell toneBlue
class node_admin_module,node_admin_routing,node_admin_layout,node_admin_operations,node_inventory_module,node_inventory_routing,node_inventory_stock,node_admin_payments toneAmber
class node_sales_module,node_sales_routing,node_sales_layout,node_billing,node_bill_route_selection,node_bill_summary,node_payment_module,node_payment_routing,node_payment_customer,node_payment_bill toneMint
class node_shared_module,node_admin_header,node_sales_nav,node_bottom_sheet_base toneRose
```

## Components

### Application Core

- [Browser Bootstrap](https://github.com/chamodhpasindu/bsdm-frontend/blob/master/src/main.ts): Angular entrypoint · `src/main.ts`
- [Root App Module](https://github.com/chamodhpasindu/bsdm-frontend/blob/master/src/app/app.module.ts): Angular module · `src/app/app.module.ts`
- [Global Routes](https://github.com/chamodhpasindu/bsdm-frontend/blob/master/src/app/app-routing.module.ts): router · Selects the admin and sales workspaces. · `src/app/app-routing.module.ts`
- [Root App Shell](https://github.com/chamodhpasindu/bsdm-frontend/blob/master/src/app/app.component.ts): root component · `src/app/app.component.ts`

### Admin Workspace

- [Admin Module](https://github.com/chamodhpasindu/bsdm-frontend/blob/master/src/app/admin/admin.module.ts): feature module · Back-office workspace boundary. · `src/app/admin/admin.module.ts`
- [Admin Routes](https://github.com/chamodhpasindu/bsdm-frontend/blob/master/src/app/admin/admin-routing.module.ts): router · `src/app/admin/admin-routing.module.ts`
- [Admin Layout](https://github.com/chamodhpasindu/bsdm-frontend/blob/master/src/app/admin/layout/layout.component.ts): layout component · `src/app/admin/layout/layout.component.ts`
- [Operational Control Screens](https://github.com/chamodhpasindu/bsdm-frontend/blob/master/src/app/admin/dashboard/dashboard.component.ts): admin screens · Dashboard, employee management, and audit trail. · `src/app/admin/dashboard/dashboard.component.ts`
- [Inventory Module](https://github.com/chamodhpasindu/bsdm-frontend/blob/master/src/app/admin/inventory-management/inventory-management.module.ts): nested feature module · Catalog, batches, stock, returns, and sales-stock operations. · `src/app/admin/inventory-management/inventory-management.module.ts`
- [Inventory Routes](https://github.com/chamodhpasindu/bsdm-frontend/blob/master/src/app/admin/inventory-management/inventory-management.routing.module.ts): router · `src/app/admin/inventory-management/inventory-management.routing.module.ts`
- [Stock Management](https://github.com/chamodhpasindu/bsdm-frontend/blob/master/src/app/admin/inventory-management/stock/stock.component.ts): inventory screen · `src/app/admin/inventory-management/stock/stock.component.ts`
- [Payment Oversight](https://github.com/chamodhpasindu/bsdm-frontend/blob/master/src/app/admin/payments/payments.component.ts): admin screen · `src/app/admin/payments/payments.component.ts`

### Sales Workspace

- [Sales Module](https://github.com/chamodhpasindu/bsdm-frontend/blob/master/src/app/sales/sales.module.ts): feature module · Field-sales workspace boundary. · `src/app/sales/sales.module.ts`
- [Sales Routes](https://github.com/chamodhpasindu/bsdm-frontend/blob/master/src/app/sales/sales-routing.module.ts): router · `src/app/sales/sales-routing.module.ts`
- [Sales Layout](https://github.com/chamodhpasindu/bsdm-frontend/blob/master/src/app/sales/layout/layout.component.ts): layout component · `src/app/sales/layout/layout.component.ts`
- [Billing Workflow](https://github.com/chamodhpasindu/bsdm-frontend/blob/master/src/app/sales/bill/bill.module.ts): staged feature module · Route/customer selection, product selection, and bill summary. · `src/app/sales/bill/bill.module.ts`
- [Billing Route Selection](https://github.com/chamodhpasindu/bsdm-frontend/blob/master/src/app/sales/bill/select-route/select-route.component.ts): workflow screen · `src/app/sales/bill/select-route/select-route.component.ts`
- [Bill Summary](https://github.com/chamodhpasindu/bsdm-frontend/blob/master/src/app/sales/bill/bill-summary/bill-summary.component.ts): workflow screen · `src/app/sales/bill/bill-summary/bill-summary.component.ts`
- [Payment Workflow](https://github.com/chamodhpasindu/bsdm-frontend/blob/master/src/app/sales/payment/payment.module.ts): staged feature module · Route, customer, bill selection, then payment handling. · `src/app/sales/payment/payment.module.ts`
- [Payment Routes](https://github.com/chamodhpasindu/bsdm-frontend/blob/master/src/app/sales/payment/payment-routing.module.ts): router · `src/app/sales/payment/payment-routing.module.ts`
- [Payment Customer Selection](https://github.com/chamodhpasindu/bsdm-frontend/blob/master/src/app/sales/payment/select-customer/select-customer.component.ts): workflow screen · `src/app/sales/payment/select-customer/select-customer.component.ts`
- [Payment Bill Selection](https://github.com/chamodhpasindu/bsdm-frontend/blob/master/src/app/sales/payment/select-bill/select-bill.component.ts): workflow screen · `src/app/sales/payment/select-bill/select-bill.component.ts`

### Shared UI

- [Shared Module](https://github.com/chamodhpasindu/bsdm-frontend/blob/master/src/app/shared/shared.module.ts): shared UI module · Common presentation components for both workspaces. · `src/app/shared/shared.module.ts`
- [Admin Header](https://github.com/chamodhpasindu/bsdm-frontend/blob/master/src/app/shared/admin-header/admin-header.component.ts): shared component · `src/app/shared/admin-header/admin-header.component.ts`
- [Sales Bottom Navigation](https://github.com/chamodhpasindu/bsdm-frontend/blob/master/src/app/shared/sales-bottom-nav/sales-bottom-nav.component.ts): shared component · `src/app/shared/sales-bottom-nav/sales-bottom-nav.component.ts`
- [Bottom Sheet Base](https://github.com/chamodhpasindu/bsdm-frontend/blob/master/src/utils/directives/base-bottom-sheet.directive.ts): interaction directive · Common mechanism for transient sales actions and summaries. · `src/utils/directives/base-bottom-sheet.directive.ts`

## Connections

- Browser Bootstrap → Root App Module: bootstraps
- Root App Module → Root App Shell: declares
- Root App Module → Global Routes: registers
- Global Routes → Admin Module: routes to
- Global Routes → Sales Module: routes to
- Admin Module → Admin Routes: configures
- Admin Routes → Admin Layout: renders
- Admin Layout → Operational Control Screens: hosts
- Admin Module → Inventory Module: contains
- Inventory Module → Inventory Routes: configures
- Inventory Routes → Stock Management: routes to
- Admin Layout → Payment Oversight: hosts
- Sales Module → Sales Routes: configures
- Sales Routes → Sales Layout: renders
- Sales Module → Billing Workflow: contains
- Billing Workflow → Billing Route Selection: starts with
- Billing Route Selection → Bill Summary: workflow state
- Sales Module → Payment Workflow: contains
- Payment Workflow → Payment Routes: configures
- Payment Routes → Payment Customer Selection: guides to
- Payment Customer Selection → Payment Bill Selection: selects bill
- Admin Module → Shared Module: uses
- Sales Module → Shared Module: uses
- Shared Module → Admin Header: provides
- Shared Module → Sales Bottom Navigation: provides
- Sales Bottom Navigation → Bottom Sheet Base: uses
