# siva-sundhar/silverline-frontend architecture

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

- Interactive diagram: https://gitdiagram.com/siva-sundhar/silverline-frontend
- Repository: https://github.com/siva-sundhar/silverline-frontend

## Overview

This is a React purchasing and sales-order application. Users sign in, view order dashboards, and create or review purchase orders; the purchase form calculates totals and builds a voucher payload, while a print view presents order data. The tree also shows sales-order screens and product lookup. Relationships below follow explicit routes, sampled calls, and SOURCE INDEX references; unsampled modules are represented only where their subsystem is clear, without assuming undocumented calls.

Main entry points: [`src/App.jsx`](https://github.com/siva-sundhar/silverline-frontend/blob/main/src/App.jsx) (Route application), [`src/store/useAppStore.js`](https://github.com/siva-sundhar/silverline-frontend/blob/main/src/store/useAppStore.js) (Session and app state), [`src/API/purchaseOrderApi.js`](https://github.com/siva-sundhar/silverline-frontend/blob/main/src/API/purchaseOrderApi.js) (Purchase API), [`src/API/server_api.js`](https://github.com/siva-sundhar/silverline-frontend/blob/main/src/API/server_api.js) (HTTP client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Application navigation"]
  node_app["Route application<br/>[App.jsx]"]
  node_login["Sign in<br/>[LoginPage.jsx]"]
  node_dashboard["Main dashboard<br/>[Dashboard.jsx]"]
  node_po_dashboard["Purchase dashboard"]
  node_so_dashboard["Sales dashboard"]
end

subgraph group_orders["Order workflows"]
  node_purchase_page["Purchase form page<br/>[PurchaseOrder.jsx]"]
  node_purchase_header["Purchase header"]
  node_purchase_form["Purchase form state"]
  node_purchase_legacy["Purchase order screen<br/>[PurchaseOrder.jsx]"]
  node_sale_order["Sales order<br/>[SaleOrder.jsx]"]
end

subgraph group_services["Data and services"]
  node_purchase_api["Purchase API"]
  node_sale_api["Sales API<br/>[saleOrderApi.js]"]
  node_product_hook["Product lookup<br/>[useProducts.js]"]
  node_app_state[("Session and app state<br/>[useAppStore.js]")]
  node_http_client["HTTP client<br/>[server_api.js]"]
  node_product_api["Product API<br/>[productApi.js]"]
end

subgraph group_shared["Shared logic and output"]
  node_voucher_totals["Voucher totals<br/>[voucherTotals.js]"]
  node_payload["Purchase payload"]
  node_print["Purchase print view<br/>[PurchasePrint.jsx]"]
end

node_user(("User"))

node_user -->|"opens"| node_app
node_app -->|"routes to"| node_login
node_app -->|"routes to"| node_dashboard
node_app -->|"routes to"| node_po_dashboard
node_app -->|"routes to"| node_so_dashboard
node_app -->|"routes to"| node_purchase_page
node_app -->|"routes to"| node_print
node_login -->|"updates session"| node_app_state
node_login -->|"authenticates via"| node_http_client
node_dashboard -->|"loads orders"| node_purchase_api
node_dashboard -->|"loads products"| node_product_hook
node_po_dashboard -->|"loads orders"| node_purchase_api
node_purchase_page -->|"renders"| node_purchase_header
node_purchase_form -->|"calculates totals"| node_voucher_totals
node_purchase_form -->|"builds payload"| node_payload
node_purchase_legacy -->|"previews number"| node_purchase_api
node_purchase_legacy -->|"renders preview"| node_print
node_purchase_api -->|"sends requests"| node_http_client
node_http_client -->|"reads token"| node_app_state
node_product_hook -->|"fetches products"| node_product_api
node_product_hook -->|"reads and updates"| node_app_state
node_product_api -->|"sends requests"| node_http_client
node_voucher_totals -->|"supplies totals"| node_payload
node_sale_order -->|"uses state"| node_app_state
node_so_dashboard -->|"uses state"| node_app_state

click node_app "https://github.com/siva-sundhar/silverline-frontend/blob/main/src/App.jsx"
click node_login "https://github.com/siva-sundhar/silverline-frontend/blob/main/src/features/auth/LoginPage.jsx"
click node_dashboard "https://github.com/siva-sundhar/silverline-frontend/blob/main/src/features/dashboard/Dashboard.jsx"
click node_po_dashboard "https://github.com/siva-sundhar/silverline-frontend/blob/main/src/features/dashboard/PurchaseOrderDsashboard.jsx"
click node_so_dashboard "https://github.com/siva-sundhar/silverline-frontend/blob/main/src/features/dashboard/SaleOrderDashboard.jsx"
click node_purchase_page "https://github.com/siva-sundhar/silverline-frontend/blob/main/src/features/purchase_order/page/PurchaseOrder.jsx"
click node_purchase_header "https://github.com/siva-sundhar/silverline-frontend/blob/main/src/features/purchase_order/components/PurchaseOrderHeader.jsx"
click node_purchase_form "https://github.com/siva-sundhar/silverline-frontend/blob/main/src/features/purchase_order/hooks/usePurchaseOrderForm.js"
click node_purchase_legacy "https://github.com/siva-sundhar/silverline-frontend/blob/main/src/components/purchase_order/PurchaseOrder.jsx"
click node_sale_order "https://github.com/siva-sundhar/silverline-frontend/blob/main/src/features/sale_order/SaleOrder.jsx"
click node_purchase_api "https://github.com/siva-sundhar/silverline-frontend/blob/main/src/API/purchaseOrderApi.js"
click node_sale_api "https://github.com/siva-sundhar/silverline-frontend/blob/main/src/API/saleOrderApi.js"
click node_product_hook "https://github.com/siva-sundhar/silverline-frontend/blob/main/src/hooks/useProducts.js"
click node_app_state "https://github.com/siva-sundhar/silverline-frontend/blob/main/src/store/useAppStore.js"
click node_http_client "https://github.com/siva-sundhar/silverline-frontend/blob/main/src/API/server_api.js"
click node_voucher_totals "https://github.com/siva-sundhar/silverline-frontend/blob/main/src/utils/calculations/voucher/voucherTotals.js"
click node_payload "https://github.com/siva-sundhar/silverline-frontend/blob/main/src/utils/calculations/payload/purchaseOrderPayload.js"
click node_print "https://github.com/siva-sundhar/silverline-frontend/blob/main/src/components/print/PurchasePrint.jsx"
click node_product_api "https://github.com/siva-sundhar/silverline-frontend/blob/main/src/API/productApi.js"

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_app,node_login,node_dashboard,node_po_dashboard,node_so_dashboard,node_user toneBlue
class node_purchase_page,node_purchase_header,node_purchase_form,node_purchase_legacy,node_sale_order toneAmber
class node_purchase_api,node_sale_api,node_product_hook,node_app_state,node_http_client,node_product_api toneMint
class node_voucher_totals,node_payload,node_print toneRose
```

## Components

### Application navigation

- [Route application](https://github.com/siva-sundhar/silverline-frontend/blob/main/src/App.jsx): `src/App.jsx`
- [Sign in](https://github.com/siva-sundhar/silverline-frontend/blob/main/src/features/auth/LoginPage.jsx): `src/features/auth/LoginPage.jsx`
- [Main dashboard](https://github.com/siva-sundhar/silverline-frontend/blob/main/src/features/dashboard/Dashboard.jsx): `src/features/dashboard/Dashboard.jsx`
- [Purchase dashboard](https://github.com/siva-sundhar/silverline-frontend/blob/main/src/features/dashboard/PurchaseOrderDsashboard.jsx): `src/features/dashboard/PurchaseOrderDsashboard.jsx`
- [Sales dashboard](https://github.com/siva-sundhar/silverline-frontend/blob/main/src/features/dashboard/SaleOrderDashboard.jsx): `src/features/dashboard/SaleOrderDashboard.jsx`

### Order workflows

- [Purchase form page](https://github.com/siva-sundhar/silverline-frontend/blob/main/src/features/purchase_order/page/PurchaseOrder.jsx): `src/features/purchase_order/page/PurchaseOrder.jsx`
- [Purchase header](https://github.com/siva-sundhar/silverline-frontend/blob/main/src/features/purchase_order/components/PurchaseOrderHeader.jsx): `src/features/purchase_order/components/PurchaseOrderHeader.jsx`
- [Purchase form state](https://github.com/siva-sundhar/silverline-frontend/blob/main/src/features/purchase_order/hooks/usePurchaseOrderForm.js): `src/features/purchase_order/hooks/usePurchaseOrderForm.js`
- [Purchase order screen](https://github.com/siva-sundhar/silverline-frontend/blob/main/src/components/purchase_order/PurchaseOrder.jsx): `src/components/purchase_order/PurchaseOrder.jsx`
- [Sales order](https://github.com/siva-sundhar/silverline-frontend/blob/main/src/features/sale_order/SaleOrder.jsx): `src/features/sale_order/SaleOrder.jsx`

### Data and services

- [Purchase API](https://github.com/siva-sundhar/silverline-frontend/blob/main/src/API/purchaseOrderApi.js): `src/API/purchaseOrderApi.js`
- [Sales API](https://github.com/siva-sundhar/silverline-frontend/blob/main/src/API/saleOrderApi.js): `src/API/saleOrderApi.js`
- [Product lookup](https://github.com/siva-sundhar/silverline-frontend/blob/main/src/hooks/useProducts.js): `src/hooks/useProducts.js`
- [Session and app state](https://github.com/siva-sundhar/silverline-frontend/blob/main/src/store/useAppStore.js): `src/store/useAppStore.js`
- [HTTP client](https://github.com/siva-sundhar/silverline-frontend/blob/main/src/API/server_api.js): `src/API/server_api.js`
- [Product API](https://github.com/siva-sundhar/silverline-frontend/blob/main/src/API/productApi.js): `src/API/productApi.js`

### Shared logic and output

- [Voucher totals](https://github.com/siva-sundhar/silverline-frontend/blob/main/src/utils/calculations/voucher/voucherTotals.js): `src/utils/calculations/voucher/voucherTotals.js`
- [Purchase payload](https://github.com/siva-sundhar/silverline-frontend/blob/main/src/utils/calculations/payload/purchaseOrderPayload.js): `src/utils/calculations/payload/purchaseOrderPayload.js`
- [Purchase print view](https://github.com/siva-sundhar/silverline-frontend/blob/main/src/components/print/PurchasePrint.jsx): `src/components/print/PurchasePrint.jsx`

### Other components

- **User**

## Connections

- User → Route application: opens (evidence: `src/App.jsx`)
- Route application → Sign in: routes to (evidence: `src/App.jsx`)
- Route application → Main dashboard: routes to (evidence: `src/App.jsx`)
- Route application → Purchase dashboard: routes to (evidence: `src/App.jsx`)
- Route application → Sales dashboard: routes to (evidence: `src/App.jsx`)
- Route application → Purchase form page: routes to (evidence: `src/App.jsx`)
- Route application → Purchase print view: routes to (evidence: `src/App.jsx`)
- Sign in → Session and app state: updates session (evidence: `src/features/auth/LoginPage.jsx`)
- Sign in → HTTP client: authenticates via
- Main dashboard → Purchase API: loads orders (evidence: `src/features/dashboard/Dashboard.jsx`)
- Main dashboard → Product lookup: loads products (evidence: `src/features/dashboard/Dashboard.jsx`)
- Purchase dashboard → Purchase API: loads orders (evidence: `src/features/dashboard/PurchaseOrderDsashboard.jsx`)
- Purchase form page → Purchase header: renders (evidence: `src/features/purchase_order/page/PurchaseOrder.jsx`)
- Purchase form state → Voucher totals: calculates totals (evidence: `src/features/purchase_order/hooks/usePurchaseOrderForm.js`)
- Purchase form state → Purchase payload: builds payload (evidence: `src/features/purchase_order/hooks/usePurchaseOrderForm.js`)
- Purchase order screen → Purchase API: previews number (evidence: `src/components/purchase_order/PurchaseOrder.jsx`)
- Purchase order screen → Purchase print view: renders preview (evidence: `src/components/purchase_order/PurchaseOrder.jsx`)
- Purchase API → HTTP client: sends requests (evidence: `src/API/purchaseOrderApi.js`)
- HTTP client → Session and app state: reads token (evidence: `src/API/server_api.js`)
- Product lookup → Product API: fetches products (evidence: `src/hooks/useProducts.js`)
- Product lookup → Session and app state: reads and updates (evidence: `src/hooks/useProducts.js`)
- Product API → HTTP client: sends requests (evidence: `src/API/productApi.js`)
- Voucher totals → Purchase payload: supplies totals (evidence: `src/utils/calculations/payload/purchaseOrderPayload.js`)
- Sales order → Session and app state: uses state (evidence: `src/features/sale_order/SaleOrder.jsx`)
- Sales dashboard → Session and app state: uses state (evidence: `src/features/dashboard/SaleOrderDashboard.jsx`)
