# aniketnandi2015-droid/hmis-project- architecture

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

- Interactive diagram: https://gitdiagram.com/aniketnandi2015-droid/hmis-project-
- Repository: https://github.com/aniketnandi2015-droid/hmis-project-

## Overview

PharmaAssist is a single-operator pharmacy counter and inventory application. The principal workflow is selecting medicines and batches, checking cart pricing and clinical safety, then recording a dispatch; separate workflows reconcile stock, recommend procurement, scan packages, and surface operational analytics. The graph reflects documented capabilities and source-index references. Some wiring and persistence details are unsampled, so uncertain connections are omitted rather than inferred.

Main entry points: [`src/App.tsx`](https://github.com/aniketnandi2015-droid/hmis-project-/blob/main/src/App.tsx) (App coordinator), [`src/components/InsightsScreen.tsx`](https://github.com/aniketnandi2015-droid/hmis-project-/blob/main/src/components/InsightsScreen.tsx) (Operational insights), [`src/lib/domain/pos/cartService.ts`](https://github.com/aniketnandi2015-droid/hmis-project-/blob/main/src/lib/domain/pos/cartService.ts) (Cart rules), [`src/components/LoginModal.tsx`](https://github.com/aniketnandi2015-droid/hmis-project-/blob/main/src/components/LoginModal.tsx) (Login screen)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Application"]
  node_app_shell["App coordinator<br/>[App.tsx]"]
  node_auth_ui["Login screen<br/>[LoginModal.tsx]"]
  node_auth["Authentication rules<br/>[authService.ts]"]
  node_language_ui["Navigation<br/>[Navbar.tsx]"]
end

subgraph group_sales["Counter Sales"]
  node_pos["Counter POS<br/>[CounterPOS.tsx]"]
  node_cart_ui["Cart drawer<br/>[CartDrawer.tsx]"]
  node_cart_logic["Cart rules<br/>[cartService.ts]"]
  node_pricing["Pricing rules"]
  node_safety["Safety checks"]
  node_invoice["Invoice generation"]
  node_receipt["Receipt printing"]
end

subgraph group_stock["Inventory &amp; Supply"]
  node_inventory_ui["Inventory screen"]
  node_discrepancy_ui["Discrepancy review"]
  node_discrepancy["Stock reconciliation"]
  node_expiry["Expiry checks"]
  node_procurement_ui["Procurement screen"]
  node_procurement["Order recommendations"]
  node_supplier_quality["Supplier quality"]
end

subgraph group_insights["Insights &amp; Scanning"]
  node_insights_ui["Operational insights<br/>[InsightsScreen.tsx]"]
  node_alerts["Inventory alerts"]
  node_forecast["Demand forecasting"]
  node_cross_sell["Cross-sell analysis"]
  node_scanner_ui["Package scanner"]
  node_ocr["Scan matching"]
end

subgraph group_platform["Shared Platform"]
  node_storage[("Local storage adapter<br/>[storageAdapter.ts]")]
  node_sync["Offline synchronization"]
  node_translations["English &amp; Hindi<br/>[translations.ts]"]
end

node_operator(("Counter operator"))
node_supabase[("Supabase backend")]

node_operator -->|"uses"| node_app_shell
node_app_shell -->|"renders"| node_pos
node_app_shell -->|"renders"| node_inventory_ui
node_app_shell -->|"renders"| node_procurement_ui
node_app_shell -->|"renders"| node_insights_ui
node_app_shell -->|"renders"| node_cart_ui
node_pos -->|"uses"| node_cart_logic
node_cart_ui -->|"uses"| node_cart_logic
node_cart_logic -->|"checks"| node_safety
node_cart_logic -->|"calculates"| node_pricing
node_app_shell -->|"persists transactions"| node_storage
node_inventory_ui -->|"checks batches"| node_expiry
node_discrepancy_ui -->|"reconciles"| node_discrepancy
node_app_shell -->|"opens"| node_discrepancy_ui
node_procurement_ui -->|"requests recommendations"| node_procurement
node_insights_ui -->|"shows alerts"| node_alerts
node_insights_ui -->|"shows forecasts"| node_forecast
node_insights_ui -->|"shows supplier events"| node_supplier_quality
node_scanner_ui -->|"matches scan"| node_ocr
node_app_shell -->|"opens"| node_scanner_ui
node_auth_ui -->|"checks credentials"| node_auth
node_app_shell -->|"renders"| node_auth_ui
node_app_shell -->|"coordinates offline sync"| node_sync
node_storage -.->|"syncs queued changes"| node_supabase
node_language_ui -->|"uses labels"| node_translations
node_insights_ui -.->|"presents suggestions"| node_cross_sell
node_app_shell -->|"opens"| node_invoice
node_app_shell -->|"opens"| node_receipt

click node_app_shell "https://github.com/aniketnandi2015-droid/hmis-project-/blob/main/src/App.tsx"
click node_pos "https://github.com/aniketnandi2015-droid/hmis-project-/blob/main/src/components/CounterPOS.tsx"
click node_cart_ui "https://github.com/aniketnandi2015-droid/hmis-project-/blob/main/src/components/CartDrawer.tsx"
click node_cart_logic "https://github.com/aniketnandi2015-droid/hmis-project-/blob/main/src/lib/domain/pos/cartService.ts"
click node_pricing "https://github.com/aniketnandi2015-droid/hmis-project-/blob/main/src/lib/domain/pricing/pricingDiscountService.ts"
click node_safety "https://github.com/aniketnandi2015-droid/hmis-project-/blob/main/src/lib/domain/safety/safetyCheckService.ts"
click node_invoice "https://github.com/aniketnandi2015-droid/hmis-project-/blob/main/src/components/InvoiceGeneratorModal.tsx"
click node_receipt "https://github.com/aniketnandi2015-droid/hmis-project-/blob/main/src/components/ReceiptPrintModal.tsx"
click node_inventory_ui "https://github.com/aniketnandi2015-droid/hmis-project-/blob/main/src/components/InventoryScreen.tsx"
click node_discrepancy_ui "https://github.com/aniketnandi2015-droid/hmis-project-/blob/main/src/components/StockDiscrepancyModal.tsx"
click node_discrepancy "https://github.com/aniketnandi2015-droid/hmis-project-/blob/main/src/lib/domain/inventory/discrepancyService.ts"
click node_expiry "https://github.com/aniketnandi2015-droid/hmis-project-/blob/main/src/lib/domain/inventory/nearExpiryService.ts"
click node_procurement_ui "https://github.com/aniketnandi2015-droid/hmis-project-/blob/main/src/components/ProcurementScreen.tsx"
click node_procurement "https://github.com/aniketnandi2015-droid/hmis-project-/blob/main/src/lib/domain/procurement/procurementService.ts"
click node_supplier_quality "https://github.com/aniketnandi2015-droid/hmis-project-/blob/main/src/lib/domain/procurement/supplierQualityService.ts"
click node_insights_ui "https://github.com/aniketnandi2015-droid/hmis-project-/blob/main/src/components/InsightsScreen.tsx"
click node_alerts "https://github.com/aniketnandi2015-droid/hmis-project-/blob/main/src/lib/domain/inventory/inventoryAlertService.ts"
click node_forecast "https://github.com/aniketnandi2015-droid/hmis-project-/blob/main/src/lib/domain/analytics/timeSeriesForecastService.ts"
click node_cross_sell "https://github.com/aniketnandi2015-droid/hmis-project-/blob/main/src/lib/domain/analytics/crossSellService.ts"
click node_scanner_ui "https://github.com/aniketnandi2015-droid/hmis-project-/blob/main/src/components/BarcodeScannerModal.tsx"
click node_ocr "https://github.com/aniketnandi2015-droid/hmis-project-/blob/main/src/lib/domain/ocr/smartScanService.ts"
click node_auth_ui "https://github.com/aniketnandi2015-droid/hmis-project-/blob/main/src/components/LoginModal.tsx"
click node_auth "https://github.com/aniketnandi2015-droid/hmis-project-/blob/main/src/lib/domain/authentication/authService.ts"
click node_storage "https://github.com/aniketnandi2015-droid/hmis-project-/blob/main/src/lib/offline/storageAdapter.ts"
click node_sync "https://github.com/aniketnandi2015-droid/hmis-project-/blob/main/src/lib/domain/synchronization/offlineSyncService.ts"
click node_translations "https://github.com/aniketnandi2015-droid/hmis-project-/blob/main/src/lib/i18n/translations.ts"
click node_language_ui "https://github.com/aniketnandi2015-droid/hmis-project-/blob/main/src/components/Navbar.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_app_shell,node_auth_ui,node_auth,node_language_ui toneBlue
class node_pos,node_cart_ui,node_cart_logic,node_pricing,node_safety,node_invoice,node_receipt,node_supabase toneAmber
class node_inventory_ui,node_discrepancy_ui,node_discrepancy,node_expiry,node_procurement_ui,node_procurement,node_supplier_quality toneMint
class node_insights_ui,node_alerts,node_forecast,node_cross_sell,node_scanner_ui,node_ocr toneRose
class node_storage,node_sync,node_translations,node_operator toneIndigo
```

## Components

### Application

- [App coordinator](https://github.com/aniketnandi2015-droid/hmis-project-/blob/main/src/App.tsx): `src/App.tsx`
- [Login screen](https://github.com/aniketnandi2015-droid/hmis-project-/blob/main/src/components/LoginModal.tsx): `src/components/LoginModal.tsx`
- [Authentication rules](https://github.com/aniketnandi2015-droid/hmis-project-/blob/main/src/lib/domain/authentication/authService.ts): `src/lib/domain/authentication/authService.ts`
- [Navigation](https://github.com/aniketnandi2015-droid/hmis-project-/blob/main/src/components/Navbar.tsx): `src/components/Navbar.tsx`

### Counter Sales

- [Counter POS](https://github.com/aniketnandi2015-droid/hmis-project-/blob/main/src/components/CounterPOS.tsx): `src/components/CounterPOS.tsx`
- [Cart drawer](https://github.com/aniketnandi2015-droid/hmis-project-/blob/main/src/components/CartDrawer.tsx): `src/components/CartDrawer.tsx`
- [Cart rules](https://github.com/aniketnandi2015-droid/hmis-project-/blob/main/src/lib/domain/pos/cartService.ts): `src/lib/domain/pos/cartService.ts`
- [Pricing rules](https://github.com/aniketnandi2015-droid/hmis-project-/blob/main/src/lib/domain/pricing/pricingDiscountService.ts): `src/lib/domain/pricing/pricingDiscountService.ts`
- [Safety checks](https://github.com/aniketnandi2015-droid/hmis-project-/blob/main/src/lib/domain/safety/safetyCheckService.ts): `src/lib/domain/safety/safetyCheckService.ts`
- [Invoice generation](https://github.com/aniketnandi2015-droid/hmis-project-/blob/main/src/components/InvoiceGeneratorModal.tsx): `src/components/InvoiceGeneratorModal.tsx`
- [Receipt printing](https://github.com/aniketnandi2015-droid/hmis-project-/blob/main/src/components/ReceiptPrintModal.tsx): `src/components/ReceiptPrintModal.tsx`

### Inventory & Supply

- [Inventory screen](https://github.com/aniketnandi2015-droid/hmis-project-/blob/main/src/components/InventoryScreen.tsx): `src/components/InventoryScreen.tsx`
- [Discrepancy review](https://github.com/aniketnandi2015-droid/hmis-project-/blob/main/src/components/StockDiscrepancyModal.tsx): `src/components/StockDiscrepancyModal.tsx`
- [Stock reconciliation](https://github.com/aniketnandi2015-droid/hmis-project-/blob/main/src/lib/domain/inventory/discrepancyService.ts): `src/lib/domain/inventory/discrepancyService.ts`
- [Expiry checks](https://github.com/aniketnandi2015-droid/hmis-project-/blob/main/src/lib/domain/inventory/nearExpiryService.ts): `src/lib/domain/inventory/nearExpiryService.ts`
- [Procurement screen](https://github.com/aniketnandi2015-droid/hmis-project-/blob/main/src/components/ProcurementScreen.tsx): `src/components/ProcurementScreen.tsx`
- [Order recommendations](https://github.com/aniketnandi2015-droid/hmis-project-/blob/main/src/lib/domain/procurement/procurementService.ts): `src/lib/domain/procurement/procurementService.ts`
- [Supplier quality](https://github.com/aniketnandi2015-droid/hmis-project-/blob/main/src/lib/domain/procurement/supplierQualityService.ts): `src/lib/domain/procurement/supplierQualityService.ts`

### Insights & Scanning

- [Operational insights](https://github.com/aniketnandi2015-droid/hmis-project-/blob/main/src/components/InsightsScreen.tsx): `src/components/InsightsScreen.tsx`
- [Inventory alerts](https://github.com/aniketnandi2015-droid/hmis-project-/blob/main/src/lib/domain/inventory/inventoryAlertService.ts): `src/lib/domain/inventory/inventoryAlertService.ts`
- [Demand forecasting](https://github.com/aniketnandi2015-droid/hmis-project-/blob/main/src/lib/domain/analytics/timeSeriesForecastService.ts): `src/lib/domain/analytics/timeSeriesForecastService.ts`
- [Cross-sell analysis](https://github.com/aniketnandi2015-droid/hmis-project-/blob/main/src/lib/domain/analytics/crossSellService.ts): `src/lib/domain/analytics/crossSellService.ts`
- [Package scanner](https://github.com/aniketnandi2015-droid/hmis-project-/blob/main/src/components/BarcodeScannerModal.tsx): `src/components/BarcodeScannerModal.tsx`
- [Scan matching](https://github.com/aniketnandi2015-droid/hmis-project-/blob/main/src/lib/domain/ocr/smartScanService.ts): `src/lib/domain/ocr/smartScanService.ts`

### Shared Platform

- [Local storage adapter](https://github.com/aniketnandi2015-droid/hmis-project-/blob/main/src/lib/offline/storageAdapter.ts): `src/lib/offline/storageAdapter.ts`
- [Offline synchronization](https://github.com/aniketnandi2015-droid/hmis-project-/blob/main/src/lib/domain/synchronization/offlineSyncService.ts): `src/lib/domain/synchronization/offlineSyncService.ts`
- [English & Hindi](https://github.com/aniketnandi2015-droid/hmis-project-/blob/main/src/lib/i18n/translations.ts): `src/lib/i18n/translations.ts`

### Other components

- **Counter operator**
- **Supabase backend**

## Connections

- Counter operator → App coordinator: uses (evidence: `README.md`)
- App coordinator → Counter POS: renders (evidence: `src/App.tsx`)
- App coordinator → Inventory screen: renders (evidence: `src/App.tsx`)
- App coordinator → Procurement screen: renders (evidence: `src/App.tsx`)
- App coordinator → Operational insights: renders (evidence: `src/App.tsx`)
- App coordinator → Cart drawer: renders (evidence: `src/App.tsx`)
- Counter POS → Cart rules: uses (evidence: `src/components/CounterPOS.tsx`)
- Cart drawer → Cart rules: uses (evidence: `src/components/CartDrawer.tsx`)
- Cart rules → Safety checks: checks (evidence: `src/lib/domain/pos/cartService.ts`)
- Cart rules → Pricing rules: calculates (evidence: `src/lib/domain/pos/cartService.ts`)
- App coordinator → Local storage adapter: persists transactions (evidence: `README.md`)
- Inventory screen → Expiry checks: checks batches (evidence: `src/components/InventoryScreen.tsx`)
- Discrepancy review → Stock reconciliation: reconciles (evidence: `src/components/StockDiscrepancyModal.tsx`)
- App coordinator → Discrepancy review: opens (evidence: `src/App.tsx`)
- Procurement screen → Order recommendations: requests recommendations (evidence: `src/components/ProcurementScreen.tsx`)
- Operational insights → Inventory alerts: shows alerts (evidence: `src/components/InsightsScreen.tsx`)
- Operational insights → Demand forecasting: shows forecasts (evidence: `src/components/InsightsScreen.tsx`)
- Operational insights → Supplier quality: shows supplier events (evidence: `src/components/InsightsScreen.tsx`)
- Package scanner → Scan matching: matches scan (evidence: `src/components/BarcodeScannerModal.tsx`)
- App coordinator → Package scanner: opens (evidence: `src/App.tsx`)
- Login screen → Authentication rules: checks credentials (evidence: `src/components/LoginModal.tsx`)
- App coordinator → Login screen: renders (evidence: `src/App.tsx`)
- App coordinator → Offline synchronization: coordinates offline sync (evidence: `src/App.tsx`)
- Local storage adapter → Supabase backend: syncs queued changes
- Navigation → English & Hindi: uses labels (evidence: `src/components/Navbar.tsx`)
- Operational insights → Cross-sell analysis: presents suggestions
- App coordinator → Invoice generation: opens (evidence: `src/App.tsx`)
- App coordinator → Receipt printing: opens (evidence: `src/App.tsx`)
