# pplcallmesk-15/grocery-pos-desktop architecture

> Architecture diagram of the GitHub repository pplcallmesk-15/grocery-pos-desktop, 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/pplcallmesk-15/grocery-pos-desktop
- Repository: https://github.com/pplcallmesk-15/grocery-pos-desktop

## Overview

This is an offline-first grocery POS and inventory desktop application. The main workflow is a cashier scanning products into a cart, completing a bill with cash or dynamic UPI payment, and retaining sales and stock data locally. The application also covers purchasing, customer accounts, returns, branch and staff operations, reporting, and recovery. The graph reflects the documented capabilities and the sampled import wiring; several view-to-storage interactions are inferred only where the source index names the dependency, so those edges are dashed.

Main entry points: [`src/App.tsx`](https://github.com/pplcallmesk-15/grocery-pos-desktop/blob/main/src/App.tsx) (App controller), [`src/db/sqliteStorage.ts`](https://github.com/pplcallmesk-15/grocery-pos-desktop/blob/main/src/db/sqliteStorage.ts) (Local data store), [`src/components/POSBillingView.tsx`](https://github.com/pplcallmesk-15/grocery-pos-desktop/blob/main/src/components/POSBillingView.tsx) (POS billing), [`src/components/SmartReorderView.tsx`](https://github.com/pplcallmesk-15/grocery-pos-desktop/blob/main/src/components/SmartReorderView.tsx) (Smart reordering)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Application Shell"]
  node_renderer["React renderer<br/>[main.tsx]"]
  node_controller["App controller<br/>[App.tsx]"]
  node_nav["Navigation<br/>[Sidebar.tsx]"]
  node_dashboard["Dashboard<br/>[DashboardView.tsx]"]
end

subgraph group_sales["Sales and Payments"]
  node_pos["POS billing<br/>[POSBillingView.tsx]"]
  node_scanner["Camera scanner"]
  node_invoice["Invoice and receipt<br/>[InvoiceModal.tsx]"]
  node_upiui["UPI payment UI"]
  node_payments["UPI QR service<br/>[paymentService.ts]"]
end

subgraph group_inventory["Inventory and Operations"]
  node_products["Product management"]
  node_stock["Incoming stock"]
  node_purchase["Purchase orders"]
  node_suppliers["Supplier management"]
  node_intelligence["Smart reordering"]
  node_branches["Branch management"]
end

subgraph group_records["Records and Recovery"]
  node_customers["Customer ledger"]
  node_returns["Returns and exchanges"]
  node_reports["Reports<br/>[ReportsView.tsx]"]
  node_backup["Backup and restore"]
  node_storage[("Local data store<br/>[sqliteStorage.ts]")]
end

node_operator(("Store staff"))
node_ai(("Gemini AI"))

node_operator -.->|"uses"| node_renderer
node_renderer -->|"renders"| node_controller
node_controller -->|"renders"| node_nav
node_controller -->|"selects view"| node_dashboard
node_controller -.->|"selects view"| node_pos
node_controller -->|"loads and updates"| node_storage
node_pos -.->|"opens"| node_scanner
node_pos -->|"opens"| node_upiui
node_pos -->|"generates payment QR"| node_payments
node_upiui -->|"generates QR"| node_payments
node_pos -->|"reads and writes"| node_storage
node_pos -.->|"prints bill"| node_invoice
node_controller -.->|"selects view"| node_products
node_controller -.->|"selects view"| node_stock
node_controller -.->|"selects view"| node_purchase
node_controller -.->|"selects view"| node_suppliers
node_controller -->|"selects view"| node_intelligence
node_controller -->|"selects view"| node_branches
node_controller -.->|"selects view"| node_customers
node_controller -.->|"selects view"| node_returns
node_controller -.->|"selects view"| node_reports
node_controller -.->|"selects view"| node_backup
node_products -.->|"uses data store"| node_storage
node_stock -.->|"uses data store"| node_storage
node_purchase -.->|"uses data store"| node_storage
node_suppliers -.->|"uses data store"| node_storage
node_intelligence -.->|"uses data store"| node_storage
node_branches -.->|"uses data store"| node_storage
node_customers -.->|"uses data store"| node_storage
node_returns -.->|"uses data store"| node_storage
node_backup -.->|"backs up and restores"| node_storage
node_intelligence -.->|"analyzes demand"| node_ai

click node_renderer "https://github.com/pplcallmesk-15/grocery-pos-desktop/blob/main/src/main.tsx"
click node_controller "https://github.com/pplcallmesk-15/grocery-pos-desktop/blob/main/src/App.tsx"
click node_nav "https://github.com/pplcallmesk-15/grocery-pos-desktop/blob/main/src/components/Sidebar.tsx"
click node_dashboard "https://github.com/pplcallmesk-15/grocery-pos-desktop/blob/main/src/components/DashboardView.tsx"
click node_pos "https://github.com/pplcallmesk-15/grocery-pos-desktop/blob/main/src/components/POSBillingView.tsx"
click node_scanner "https://github.com/pplcallmesk-15/grocery-pos-desktop/blob/main/src/components/CameraScannerModal.tsx"
click node_invoice "https://github.com/pplcallmesk-15/grocery-pos-desktop/blob/main/src/components/InvoiceModal.tsx"
click node_upiui "https://github.com/pplcallmesk-15/grocery-pos-desktop/blob/main/src/components/UPIPaymentModal.tsx"
click node_payments "https://github.com/pplcallmesk-15/grocery-pos-desktop/blob/main/src/services/paymentService.ts"
click node_products "https://github.com/pplcallmesk-15/grocery-pos-desktop/blob/main/src/components/ProductManagementView.tsx"
click node_stock "https://github.com/pplcallmesk-15/grocery-pos-desktop/blob/main/src/components/IncomingStockView.tsx"
click node_purchase "https://github.com/pplcallmesk-15/grocery-pos-desktop/blob/main/src/components/PurchaseOrderView.tsx"
click node_suppliers "https://github.com/pplcallmesk-15/grocery-pos-desktop/blob/main/src/components/SupplierManagementView.tsx"
click node_intelligence "https://github.com/pplcallmesk-15/grocery-pos-desktop/blob/main/src/components/SmartReorderView.tsx"
click node_branches "https://github.com/pplcallmesk-15/grocery-pos-desktop/blob/main/src/components/BranchManagementView.tsx"
click node_customers "https://github.com/pplcallmesk-15/grocery-pos-desktop/blob/main/src/components/CustomerManagementView.tsx"
click node_returns "https://github.com/pplcallmesk-15/grocery-pos-desktop/blob/main/src/components/ReturnsExchangesView.tsx"
click node_reports "https://github.com/pplcallmesk-15/grocery-pos-desktop/blob/main/src/components/ReportsView.tsx"
click node_backup "https://github.com/pplcallmesk-15/grocery-pos-desktop/blob/main/src/components/BackupRestoreView.tsx"
click node_storage "https://github.com/pplcallmesk-15/grocery-pos-desktop/blob/main/src/db/sqliteStorage.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_renderer,node_controller,node_nav,node_dashboard toneBlue
class node_pos,node_scanner,node_invoice,node_upiui,node_payments toneAmber
class node_products,node_stock,node_purchase,node_suppliers,node_intelligence,node_branches toneMint
class node_customers,node_returns,node_reports,node_backup,node_storage toneRose
class node_operator,node_ai toneIndigo
```

## Components

### Application Shell

- [React renderer](https://github.com/pplcallmesk-15/grocery-pos-desktop/blob/main/src/main.tsx): `src/main.tsx`
- [App controller](https://github.com/pplcallmesk-15/grocery-pos-desktop/blob/main/src/App.tsx): `src/App.tsx`
- [Navigation](https://github.com/pplcallmesk-15/grocery-pos-desktop/blob/main/src/components/Sidebar.tsx): `src/components/Sidebar.tsx`
- [Dashboard](https://github.com/pplcallmesk-15/grocery-pos-desktop/blob/main/src/components/DashboardView.tsx): `src/components/DashboardView.tsx`

### Sales and Payments

- [POS billing](https://github.com/pplcallmesk-15/grocery-pos-desktop/blob/main/src/components/POSBillingView.tsx): `src/components/POSBillingView.tsx`
- [Camera scanner](https://github.com/pplcallmesk-15/grocery-pos-desktop/blob/main/src/components/CameraScannerModal.tsx): `src/components/CameraScannerModal.tsx`
- [Invoice and receipt](https://github.com/pplcallmesk-15/grocery-pos-desktop/blob/main/src/components/InvoiceModal.tsx): `src/components/InvoiceModal.tsx`
- [UPI payment UI](https://github.com/pplcallmesk-15/grocery-pos-desktop/blob/main/src/components/UPIPaymentModal.tsx): `src/components/UPIPaymentModal.tsx`
- [UPI QR service](https://github.com/pplcallmesk-15/grocery-pos-desktop/blob/main/src/services/paymentService.ts): `src/services/paymentService.ts`

### Inventory and Operations

- [Product management](https://github.com/pplcallmesk-15/grocery-pos-desktop/blob/main/src/components/ProductManagementView.tsx): `src/components/ProductManagementView.tsx`
- [Incoming stock](https://github.com/pplcallmesk-15/grocery-pos-desktop/blob/main/src/components/IncomingStockView.tsx): `src/components/IncomingStockView.tsx`
- [Purchase orders](https://github.com/pplcallmesk-15/grocery-pos-desktop/blob/main/src/components/PurchaseOrderView.tsx): `src/components/PurchaseOrderView.tsx`
- [Supplier management](https://github.com/pplcallmesk-15/grocery-pos-desktop/blob/main/src/components/SupplierManagementView.tsx): `src/components/SupplierManagementView.tsx`
- [Smart reordering](https://github.com/pplcallmesk-15/grocery-pos-desktop/blob/main/src/components/SmartReorderView.tsx): `src/components/SmartReorderView.tsx`
- [Branch management](https://github.com/pplcallmesk-15/grocery-pos-desktop/blob/main/src/components/BranchManagementView.tsx): `src/components/BranchManagementView.tsx`

### Records and Recovery

- [Customer ledger](https://github.com/pplcallmesk-15/grocery-pos-desktop/blob/main/src/components/CustomerManagementView.tsx): `src/components/CustomerManagementView.tsx`
- [Returns and exchanges](https://github.com/pplcallmesk-15/grocery-pos-desktop/blob/main/src/components/ReturnsExchangesView.tsx): `src/components/ReturnsExchangesView.tsx`
- [Reports](https://github.com/pplcallmesk-15/grocery-pos-desktop/blob/main/src/components/ReportsView.tsx): `src/components/ReportsView.tsx`
- [Backup and restore](https://github.com/pplcallmesk-15/grocery-pos-desktop/blob/main/src/components/BackupRestoreView.tsx): `src/components/BackupRestoreView.tsx`
- [Local data store](https://github.com/pplcallmesk-15/grocery-pos-desktop/blob/main/src/db/sqliteStorage.ts): `src/db/sqliteStorage.ts`

### Other components

- **Store staff**
- **Gemini AI**

## Connections

- Store staff → React renderer: uses (evidence: `README.md`)
- React renderer → App controller: renders (evidence: `src/main.tsx`)
- App controller → Navigation: renders (evidence: `src/App.tsx`)
- App controller → Dashboard: selects view (evidence: `src/App.tsx`)
- App controller → POS billing: selects view (evidence: `src/App.tsx`)
- App controller → Local data store: loads and updates (evidence: `src/App.tsx`)
- POS billing → Camera scanner: opens (evidence: `README.md`)
- POS billing → UPI payment UI: opens (evidence: `src/components/POSBillingView.tsx`)
- POS billing → UPI QR service: generates payment QR (evidence: `src/components/POSBillingView.tsx`)
- UPI payment UI → UPI QR service: generates QR (evidence: `src/components/UPIPaymentModal.tsx`)
- POS billing → Local data store: reads and writes (evidence: `src/components/POSBillingView.tsx`)
- POS billing → Invoice and receipt: prints bill (evidence: `README.md`)
- App controller → Product management: selects view (evidence: `src/App.tsx`)
- App controller → Incoming stock: selects view (evidence: `src/App.tsx`)
- App controller → Purchase orders: selects view (evidence: `src/App.tsx`)
- App controller → Supplier management: selects view (evidence: `src/App.tsx`)
- App controller → Smart reordering: selects view (evidence: `src/App.tsx`)
- App controller → Branch management: selects view (evidence: `src/App.tsx`)
- App controller → Customer ledger: selects view (evidence: `src/App.tsx`)
- App controller → Returns and exchanges: selects view (evidence: `src/App.tsx`)
- App controller → Reports: selects view (evidence: `src/App.tsx`)
- App controller → Backup and restore: selects view (evidence: `src/App.tsx`)
- Product management → Local data store: uses data store (evidence: `src/components/ProductManagementView.tsx`)
- Incoming stock → Local data store: uses data store (evidence: `src/components/IncomingStockView.tsx`)
- Purchase orders → Local data store: uses data store (evidence: `src/components/PurchaseOrderView.tsx`)
- Supplier management → Local data store: uses data store (evidence: `src/components/SupplierManagementView.tsx`)
- Smart reordering → Local data store: uses data store (evidence: `src/components/SmartReorderView.tsx`)
- Branch management → Local data store: uses data store (evidence: `src/components/BranchManagementView.tsx`)
- Customer ledger → Local data store: uses data store (evidence: `src/components/CustomerManagementView.tsx`)
- Returns and exchanges → Local data store: uses data store (evidence: `src/components/ReturnsExchangesView.tsx`)
- Backup and restore → Local data store: backs up and restores (evidence: `README.md`)
- Smart reordering → Gemini AI: analyzes demand (evidence: `README.md`)
