# kiowoyo21-eng/cashier-ms architecture

> Architecture diagram of the GitHub repository kiowoyo21-eng/cashier-ms, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-21). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/kiowoyo21-eng/cashier-ms
- Repository: https://github.com/kiowoyo21-eng/cashier-ms

## Overview

This is a browser-local Next.js business-management PWA for branch operations, with inventory controls, POS and fund workflows, terminal reconciliation, and standalone spreadsheet/document workspaces. The main operational flow is staff using the dashboard to manage inventory and sales, with separate review steps for stock and disbursements; office files are a parallel reporting workflow. The README and sampled references support the major capabilities, but many internal dashboard handlers were not excerpted, so those relationships are shown only where documented or indexed.

Main entry points: [`app/page.tsx`](https://github.com/kiowoyo21-eng/cashier-ms/blob/main/app/page.tsx) (Operations dashboard), [`components/ReportStudio.tsx`](https://github.com/kiowoyo21-eng/cashier-ms/blob/main/components/ReportStudio.tsx) (Report studio), [`lib/data.ts`](https://github.com/kiowoyo21-eng/cashier-ms/blob/main/lib/data.ts) (Business data and ledger), [`components/DisbursementWorkspace.tsx`](https://github.com/kiowoyo21-eng/cashier-ms/blob/main/components/DisbursementWorkspace.tsx) (Disbursement workspace)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Application entry"]
  node_home["Operations dashboard<br/>[page.tsx]"]
  node_sheet_routes["Spreadsheet routes<br/>[page.tsx]"]
  node_sheet_editor_route["Spreadsheet editor route<br/>[page.tsx]"]
  node_ui["Shared UI<br/>[Ui.tsx]"]
end

subgraph group_inventory["Inventory control"]
  node_barcode["Barcode camera<br/>[BarcodeCamera.tsx]"]
  node_bulk_scan["Bulk registration"]
  node_stock_scan["Stock scanning<br/>[StockScanPanel.tsx]"]
  node_inventory_review["Stock verification"]
  node_price_config["Cost configuration"]
end

subgraph group_transactions["Sales and funds"]
  node_pos_lines["POS line entry"]
  node_quotation_grid["Quotation grid"]
  node_cogs_review["COGS review UI<br/>[POSCostReview.tsx]"]
  node_disbursements["Disbursement workspace"]
  node_terminal_ui["Terminal tracker"]
end

subgraph group_office["Office workspaces"]
  node_studio_route["Office workspace routing<br/>[StudioRoute.tsx]"]
  node_report_studio["Report studio<br/>[ReportStudio.tsx]"]
  node_sheet_workbench["Spreadsheet editor<br/>[SheetWorkbench.tsx]"]
  node_document_workbench["Document editor"]
end

subgraph group_domain["Domain services"]
  node_business_data[("Business data and ledger<br/>[data.ts]")]
  node_disbursement_rules["Disbursement requests"]
  node_terminal_rules["Terminal reconciliation<br/>[terminal.ts]"]
  node_cogs_rules["COGS validation<br/>[pos-cogs-review.ts]"]
  node_line_rules["POS line rules<br/>[pos-line-entry.ts]"]
  node_grid_rules["Quotation rules"]
  node_studio_rules["Office file model<br/>[report-studio.ts]"]
  node_office_import["Office import<br/>[office-import.ts]"]
  node_office_html["Office HTML conversion<br/>[office-html.ts]"]
  node_office_print["Print and export<br/>[print.ts]"]
end

node_staff(("Staff"))

node_staff -->|"uses"| node_home
node_home -->|"loads and saves"| node_business_data
node_home -->|"renders"| node_bulk_scan
node_home -->|"renders"| node_stock_scan
node_home -->|"renders"| node_inventory_review
node_home -->|"renders"| node_price_config
node_home -->|"renders"| node_pos_lines
node_home -->|"renders"| node_quotation_grid
node_home -->|"renders"| node_cogs_review
node_home -->|"renders"| node_disbursements
node_home -->|"renders"| node_terminal_ui
node_bulk_scan -->|"uses"| node_barcode
node_stock_scan -->|"uses"| node_barcode
node_inventory_review -->|"uses"| node_barcode
node_disbursements -->|"uses"| node_disbursement_rules
node_disbursements -->|"reads"| node_business_data
node_terminal_ui -->|"submits reviews"| node_terminal_rules
node_terminal_rules -->|"updates"| node_business_data
node_cogs_review -->|"validates with"| node_cogs_rules
node_quotation_grid -->|"uses"| node_grid_rules
node_grid_rules -->|"uses"| node_line_rules
node_sheet_routes -->|"routes to"| node_studio_route
node_sheet_editor_route -->|"routes to"| node_studio_route
node_studio_route -->|"renders"| node_report_studio
node_report_studio -->|"reads and writes"| node_studio_rules
node_report_studio -->|"renders"| node_sheet_workbench
node_report_studio -->|"renders"| node_document_workbench
node_sheet_workbench -->|"imports"| node_office_import
node_office_import -->|"uses"| node_office_html
node_office_import -->|"converts for"| node_studio_rules
node_report_studio -->|"uses"| node_office_html
node_report_studio -->|"exports"| node_office_print
node_home -->|"uses"| node_ui
node_home -->|"provides state"| node_business_data
node_business_data -->|"defines requests for"| node_disbursement_rules
node_business_data -->|"provides POS data"| node_cogs_rules

click node_home "https://github.com/kiowoyo21-eng/cashier-ms/blob/main/app/page.tsx"
click node_sheet_routes "https://github.com/kiowoyo21-eng/cashier-ms/blob/main/app/sheets/page.tsx"
click node_sheet_editor_route "https://github.com/kiowoyo21-eng/cashier-ms/blob/main/app/sheets/%5BfileId%5D/page.tsx"
click node_barcode "https://github.com/kiowoyo21-eng/cashier-ms/blob/main/components/BarcodeCamera.tsx"
click node_bulk_scan "https://github.com/kiowoyo21-eng/cashier-ms/blob/main/components/BulkScanRegistration.tsx"
click node_stock_scan "https://github.com/kiowoyo21-eng/cashier-ms/blob/main/components/StockScanPanel.tsx"
click node_inventory_review "https://github.com/kiowoyo21-eng/cashier-ms/blob/main/components/InventoryReview.tsx"
click node_price_config "https://github.com/kiowoyo21-eng/cashier-ms/blob/main/components/PriceConfiguration.tsx"
click node_pos_lines "https://github.com/kiowoyo21-eng/cashier-ms/blob/main/components/POSLineComposer.tsx"
click node_quotation_grid "https://github.com/kiowoyo21-eng/cashier-ms/blob/main/components/POSQuotationGrid.tsx"
click node_cogs_review "https://github.com/kiowoyo21-eng/cashier-ms/blob/main/components/POSCostReview.tsx"
click node_disbursements "https://github.com/kiowoyo21-eng/cashier-ms/blob/main/components/DisbursementWorkspace.tsx"
click node_terminal_ui "https://github.com/kiowoyo21-eng/cashier-ms/blob/main/components/TerminalTracker.tsx"
click node_studio_route "https://github.com/kiowoyo21-eng/cashier-ms/blob/main/components/StudioRoute.tsx"
click node_report_studio "https://github.com/kiowoyo21-eng/cashier-ms/blob/main/components/ReportStudio.tsx"
click node_sheet_workbench "https://github.com/kiowoyo21-eng/cashier-ms/blob/main/components/SheetWorkbench.tsx"
click node_document_workbench "https://github.com/kiowoyo21-eng/cashier-ms/blob/main/components/DocumentWorkbench.tsx"
click node_business_data "https://github.com/kiowoyo21-eng/cashier-ms/blob/main/lib/data.ts"
click node_disbursement_rules "https://github.com/kiowoyo21-eng/cashier-ms/blob/main/lib/disbursement-requests.ts"
click node_terminal_rules "https://github.com/kiowoyo21-eng/cashier-ms/blob/main/lib/terminal.ts"
click node_cogs_rules "https://github.com/kiowoyo21-eng/cashier-ms/blob/main/lib/pos-cogs-review.ts"
click node_line_rules "https://github.com/kiowoyo21-eng/cashier-ms/blob/main/lib/pos-line-entry.ts"
click node_grid_rules "https://github.com/kiowoyo21-eng/cashier-ms/blob/main/lib/pos-quotation-grid.ts"
click node_studio_rules "https://github.com/kiowoyo21-eng/cashier-ms/blob/main/lib/report-studio.ts"
click node_office_import "https://github.com/kiowoyo21-eng/cashier-ms/blob/main/lib/office-import.ts"
click node_office_html "https://github.com/kiowoyo21-eng/cashier-ms/blob/main/lib/office-html.ts"
click node_office_print "https://github.com/kiowoyo21-eng/cashier-ms/blob/main/lib/print.ts"
click node_ui "https://github.com/kiowoyo21-eng/cashier-ms/blob/main/components/Ui.tsx"

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_home,node_sheet_routes,node_sheet_editor_route,node_ui toneBlue
class node_barcode,node_bulk_scan,node_stock_scan,node_inventory_review,node_price_config toneAmber
class node_pos_lines,node_quotation_grid,node_cogs_review,node_disbursements,node_terminal_ui toneMint
class node_studio_route,node_report_studio,node_sheet_workbench,node_document_workbench toneRose
class node_business_data,node_disbursement_rules,node_terminal_rules,node_cogs_rules,node_line_rules,node_grid_rules,node_studio_rules,node_office_import,node_office_html,node_office_print,node_staff toneIndigo
```

## Components

### Application entry

- [Operations dashboard](https://github.com/kiowoyo21-eng/cashier-ms/blob/main/app/page.tsx): `app/page.tsx`
- [Spreadsheet routes](https://github.com/kiowoyo21-eng/cashier-ms/blob/main/app/sheets/page.tsx): `app/sheets/page.tsx`
- [Spreadsheet editor route](https://github.com/kiowoyo21-eng/cashier-ms/blob/main/app/sheets/%5BfileId%5D/page.tsx): `app/sheets/[fileId]/page.tsx`
- [Shared UI](https://github.com/kiowoyo21-eng/cashier-ms/blob/main/components/Ui.tsx): `components/Ui.tsx`

### Inventory control

- [Barcode camera](https://github.com/kiowoyo21-eng/cashier-ms/blob/main/components/BarcodeCamera.tsx): `components/BarcodeCamera.tsx`
- [Bulk registration](https://github.com/kiowoyo21-eng/cashier-ms/blob/main/components/BulkScanRegistration.tsx): `components/BulkScanRegistration.tsx`
- [Stock scanning](https://github.com/kiowoyo21-eng/cashier-ms/blob/main/components/StockScanPanel.tsx): `components/StockScanPanel.tsx`
- [Stock verification](https://github.com/kiowoyo21-eng/cashier-ms/blob/main/components/InventoryReview.tsx): `components/InventoryReview.tsx`
- [Cost configuration](https://github.com/kiowoyo21-eng/cashier-ms/blob/main/components/PriceConfiguration.tsx): `components/PriceConfiguration.tsx`

### Sales and funds

- [POS line entry](https://github.com/kiowoyo21-eng/cashier-ms/blob/main/components/POSLineComposer.tsx): `components/POSLineComposer.tsx`
- [Quotation grid](https://github.com/kiowoyo21-eng/cashier-ms/blob/main/components/POSQuotationGrid.tsx): `components/POSQuotationGrid.tsx`
- [COGS review UI](https://github.com/kiowoyo21-eng/cashier-ms/blob/main/components/POSCostReview.tsx): `components/POSCostReview.tsx`
- [Disbursement workspace](https://github.com/kiowoyo21-eng/cashier-ms/blob/main/components/DisbursementWorkspace.tsx): `components/DisbursementWorkspace.tsx`
- [Terminal tracker](https://github.com/kiowoyo21-eng/cashier-ms/blob/main/components/TerminalTracker.tsx): `components/TerminalTracker.tsx`

### Office workspaces

- [Office workspace routing](https://github.com/kiowoyo21-eng/cashier-ms/blob/main/components/StudioRoute.tsx): `components/StudioRoute.tsx`
- [Report studio](https://github.com/kiowoyo21-eng/cashier-ms/blob/main/components/ReportStudio.tsx): `components/ReportStudio.tsx`
- [Spreadsheet editor](https://github.com/kiowoyo21-eng/cashier-ms/blob/main/components/SheetWorkbench.tsx): `components/SheetWorkbench.tsx`
- [Document editor](https://github.com/kiowoyo21-eng/cashier-ms/blob/main/components/DocumentWorkbench.tsx): `components/DocumentWorkbench.tsx`

### Domain services

- [Business data and ledger](https://github.com/kiowoyo21-eng/cashier-ms/blob/main/lib/data.ts): `lib/data.ts`
- [Disbursement requests](https://github.com/kiowoyo21-eng/cashier-ms/blob/main/lib/disbursement-requests.ts): `lib/disbursement-requests.ts`
- [Terminal reconciliation](https://github.com/kiowoyo21-eng/cashier-ms/blob/main/lib/terminal.ts): `lib/terminal.ts`
- [COGS validation](https://github.com/kiowoyo21-eng/cashier-ms/blob/main/lib/pos-cogs-review.ts): `lib/pos-cogs-review.ts`
- [POS line rules](https://github.com/kiowoyo21-eng/cashier-ms/blob/main/lib/pos-line-entry.ts): `lib/pos-line-entry.ts`
- [Quotation rules](https://github.com/kiowoyo21-eng/cashier-ms/blob/main/lib/pos-quotation-grid.ts): `lib/pos-quotation-grid.ts`
- [Office file model](https://github.com/kiowoyo21-eng/cashier-ms/blob/main/lib/report-studio.ts): `lib/report-studio.ts`
- [Office import](https://github.com/kiowoyo21-eng/cashier-ms/blob/main/lib/office-import.ts): `lib/office-import.ts`
- [Office HTML conversion](https://github.com/kiowoyo21-eng/cashier-ms/blob/main/lib/office-html.ts): `lib/office-html.ts`
- [Print and export](https://github.com/kiowoyo21-eng/cashier-ms/blob/main/lib/print.ts): `lib/print.ts`

### Other components

- **Staff**

## Connections

- Staff → Operations dashboard: uses (evidence: `README.md`)
- Operations dashboard → Business data and ledger: loads and saves (evidence: `app/page.tsx`)
- Operations dashboard → Bulk registration: renders (evidence: `app/page.tsx`)
- Operations dashboard → Stock scanning: renders (evidence: `app/page.tsx`)
- Operations dashboard → Stock verification: renders (evidence: `app/page.tsx`)
- Operations dashboard → Cost configuration: renders (evidence: `app/page.tsx`)
- Operations dashboard → POS line entry: renders (evidence: `app/page.tsx`)
- Operations dashboard → Quotation grid: renders (evidence: `app/page.tsx`)
- Operations dashboard → COGS review UI: renders (evidence: `app/page.tsx`)
- Operations dashboard → Disbursement workspace: renders (evidence: `app/page.tsx`)
- Operations dashboard → Terminal tracker: renders (evidence: `app/page.tsx`)
- Bulk registration → Barcode camera: uses (evidence: `components/BulkScanRegistration.tsx`)
- Stock scanning → Barcode camera: uses (evidence: `components/StockScanPanel.tsx`)
- Stock verification → Barcode camera: uses (evidence: `components/InventoryReview.tsx`)
- Disbursement workspace → Disbursement requests: uses (evidence: `components/DisbursementWorkspace.tsx`)
- Disbursement workspace → Business data and ledger: reads (evidence: `components/DisbursementWorkspace.tsx`)
- Terminal tracker → Terminal reconciliation: submits reviews (evidence: `components/TerminalTracker.tsx`)
- Terminal reconciliation → Business data and ledger: updates (evidence: `lib/terminal.ts`)
- COGS review UI → COGS validation: validates with (evidence: `components/POSCostReview.tsx`)
- Quotation grid → Quotation rules: uses (evidence: `lib/pos-quotation-grid.ts`)
- Quotation rules → POS line rules: uses (evidence: `lib/pos-quotation-grid.ts`)
- Spreadsheet routes → Office workspace routing: routes to (evidence: `app/sheets/page.tsx`)
- Spreadsheet editor route → Office workspace routing: routes to (evidence: `app/sheets/[fileId]/page.tsx`)
- Office workspace routing → Report studio: renders (evidence: `components/StudioRoute.tsx`)
- Report studio → Office file model: reads and writes (evidence: `components/ReportStudio.tsx`)
- Report studio → Spreadsheet editor: renders (evidence: `components/ReportStudio.tsx`)
- Report studio → Document editor: renders (evidence: `components/ReportStudio.tsx`)
- Spreadsheet editor → Office import: imports (evidence: `components/SheetWorkbench.tsx`)
- Office import → Office HTML conversion: uses (evidence: `lib/office-import.ts`)
- Office import → Office file model: converts for (evidence: `lib/office-import.ts`)
- Report studio → Office HTML conversion: uses (evidence: `components/ReportStudio.tsx`)
- Report studio → Print and export: exports (evidence: `components/ReportStudio.tsx`)
- Operations dashboard → Shared UI: uses (evidence: `app/page.tsx`)
- Operations dashboard → Business data and ledger: provides state (evidence: `app/page.tsx`)
- Business data and ledger → Disbursement requests: defines requests for (evidence: `lib/data.ts`)
- Business data and ledger → COGS validation: provides POS data (evidence: `lib/pos-cogs-review.ts`)
