# mulgundsunil1918/mmcopd architecture

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

- Interactive diagram: https://gitdiagram.com/mulgundsunil1918/mmcopd
- Repository: https://github.com/mulgundsunil1918/mmcopd

## Overview

CureDesk HMS is an offline-first clinic and hospital-management desktop application built with Electron, React and SQLite. Clinic staff use routed modules for reception, appointments, clinical care, billing, pharmacy, diagnostics, inpatient care, accounts and analytics; the renderer communicates with the Electron main process, which owns local data and can proxy calls to a network host. The README documents the principal clinic workflows and routes. Some subsystem connections are omitted because their implementations were not sampled; edges below are limited to shown imports/calls or documented routes.

Main entry points: [`src/App.tsx`](https://github.com/mulgundsunil1918/mmcopd/blob/main/src/App.tsx) (App routing), [`src/main.ts`](https://github.com/mulgundsunil1918/mmcopd/blob/main/src/main.ts) (Electron main), [`src/components/billing/QuickBillModal.tsx`](https://github.com/mulgundsunil1918/mmcopd/blob/main/src/components/billing/QuickBillModal.tsx) (Quick bill), [`src/components/pharmacy/PurchaseBillModal.tsx`](https://github.com/mulgundsunil1918/mmcopd/blob/main/src/components/pharmacy/PurchaseBillModal.tsx) (Purchase entry)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Application shell"]
  node_app["App routing<br/>[App.tsx]"]
  node_settings["Clinic settings<br/>[Settings.tsx]"]
end

subgraph group_clinical["Clinic workflows"]
  node_reception["Reception<br/>[Reception.tsx]"]
  node_appointments["Appointments<br/>[Appointments.tsx]"]
  node_doctor["Doctor queue"]
  node_ipd["Inpatient care<br/>[IPD.tsx]"]
  node_lab["Laboratory<br/>[Lab.tsx]"]
  node_radiology["Radiology<br/>[Radiology.tsx]"]
  node_opdslip["OPD slip<br/>[OpdSlip.tsx]"]
end

subgraph group_operations["Business operations"]
  node_billing["Billing<br/>[Billing.tsx]"]
  node_quickbill["Quick bill<br/>[QuickBillModal.tsx]"]
  node_billmath["Bill calculations<br/>[billing-engine.ts]"]
  node_pharmacy["Pharmacy<br/>[Pharmacy.tsx]"]
  node_purchase["Purchase entry"]
  node_billreview["Purchase review<br/>[ReviewScreen.tsx]"]
  node_accounts["Accounts<br/>[Accounts.tsx]"]
  node_analytics["Analytics<br/>[Analytics.tsx]"]
  node_whatsapp["WhatsApp<br/>[WhatsApp.tsx]"]
  node_billimport["Bill import logic<br/>[index.ts]"]
end

subgraph group_platform["Desktop and data platform"]
  node_main["Electron main<br/>[main.ts]"]
  node_db[("SQLite database<br/>[db.ts]")]
  node_settingsdb["Settings storage<br/>[settings.ts]"]
  node_ipc["IPC handlers<br/>[ipc.ts]"]
  node_netserver["Network host<br/>[network-server.ts]"]
  node_netclient["Network proxy<br/>[network-client.ts]"]
end

subgraph group_shared["Shared capabilities"]
  node_auth["Sign-in state<br/>[useAuth.tsx]"]
  node_pharmacymath["Pharmacy arithmetic<br/>[pharmacyMath.ts]"]
  node_modal["Modal UI<br/>[Modal.tsx]"]
  node_helptip["Help tips<br/>[HelpTip.tsx]"]
  node_sliptemplates["Slip templates<br/>[slip-templates.ts]"]
  node_notifications["Notifications<br/>[notifications.ts]"]
end

node_staff(("Clinic staff"))

node_staff -->|"uses"| node_app
node_app -->|"routes to"| node_reception
node_app -->|"routes to"| node_appointments
node_app -->|"routes to"| node_doctor
node_app -->|"routes to"| node_billing
node_app -->|"routes to"| node_accounts
node_app -->|"routes to"| node_analytics
node_app -->|"routes to"| node_ipd
node_app -->|"routes to"| node_lab
node_app -->|"routes to"| node_radiology
node_app -->|"routes to"| node_pharmacy
node_app -->|"routes to"| node_settings
node_app -->|"routes to"| node_whatsapp
node_quickbill -->|"renders"| node_modal
node_quickbill -->|"supports"| node_billing
node_purchase -->|"uses"| node_modal
node_purchase -->|"uses"| node_billimport
node_billreview -->|"uses"| node_billimport
node_purchase -->|"renders"| node_helptip
node_billreview -->|"renders"| node_helptip
node_main -->|"gets database"| node_db
node_main -->|"reads settings"| node_settingsdb
node_main -->|"starts host"| node_netserver
node_main -->|"configures proxy"| node_netclient
node_main -->|"runs backup"| node_ipc
node_netclient -->|"forwards handlers"| node_ipc
node_billmath -->|"uses arithmetic"| node_pharmacymath
node_quickbill -.->|"creates bills"| node_billing
node_app -->|"uses session"| node_auth
node_opdslip -->|"uses templates"| node_sliptemplates

click node_app "https://github.com/mulgundsunil1918/mmcopd/blob/main/src/App.tsx"
click node_auth "https://github.com/mulgundsunil1918/mmcopd/blob/main/src/hooks/useAuth.tsx"
click node_reception "https://github.com/mulgundsunil1918/mmcopd/blob/main/src/pages/Reception.tsx"
click node_appointments "https://github.com/mulgundsunil1918/mmcopd/blob/main/src/pages/Appointments.tsx"
click node_doctor "https://github.com/mulgundsunil1918/mmcopd/blob/main/src/pages/DoctorDashboard.tsx"
click node_billing "https://github.com/mulgundsunil1918/mmcopd/blob/main/src/pages/Billing.tsx"
click node_quickbill "https://github.com/mulgundsunil1918/mmcopd/blob/main/src/components/billing/QuickBillModal.tsx"
click node_billmath "https://github.com/mulgundsunil1918/mmcopd/blob/main/src/main/billing-engine.ts"
click node_pharmacy "https://github.com/mulgundsunil1918/mmcopd/blob/main/src/pages/Pharmacy.tsx"
click node_purchase "https://github.com/mulgundsunil1918/mmcopd/blob/main/src/components/pharmacy/PurchaseBillModal.tsx"
click node_billreview "https://github.com/mulgundsunil1918/mmcopd/blob/main/src/components/pharmacy/billImport/ReviewScreen.tsx"
click node_accounts "https://github.com/mulgundsunil1918/mmcopd/blob/main/src/pages/Accounts.tsx"
click node_analytics "https://github.com/mulgundsunil1918/mmcopd/blob/main/src/pages/Analytics.tsx"
click node_ipd "https://github.com/mulgundsunil1918/mmcopd/blob/main/src/pages/IPD.tsx"
click node_lab "https://github.com/mulgundsunil1918/mmcopd/blob/main/src/pages/Lab.tsx"
click node_radiology "https://github.com/mulgundsunil1918/mmcopd/blob/main/src/pages/Radiology.tsx"
click node_settings "https://github.com/mulgundsunil1918/mmcopd/blob/main/src/pages/Settings.tsx"
click node_whatsapp "https://github.com/mulgundsunil1918/mmcopd/blob/main/src/pages/WhatsApp.tsx"
click node_main "https://github.com/mulgundsunil1918/mmcopd/blob/main/src/main.ts"
click node_db "https://github.com/mulgundsunil1918/mmcopd/blob/main/src/db/db.ts"
click node_settingsdb "https://github.com/mulgundsunil1918/mmcopd/blob/main/src/db/settings.ts"
click node_ipc "https://github.com/mulgundsunil1918/mmcopd/blob/main/src/main/ipc.ts"
click node_netserver "https://github.com/mulgundsunil1918/mmcopd/blob/main/src/main/network-server.ts"
click node_netclient "https://github.com/mulgundsunil1918/mmcopd/blob/main/src/main/network-client.ts"
click node_billimport "https://github.com/mulgundsunil1918/mmcopd/blob/main/src/lib/billImport/index.ts"
click node_pharmacymath "https://github.com/mulgundsunil1918/mmcopd/blob/main/src/lib/pharmacyMath.ts"
click node_modal "https://github.com/mulgundsunil1918/mmcopd/blob/main/src/components/Modal.tsx"
click node_helptip "https://github.com/mulgundsunil1918/mmcopd/blob/main/src/components/HelpTip.tsx"
click node_opdslip "https://github.com/mulgundsunil1918/mmcopd/blob/main/src/components/OpdSlip.tsx"
click node_sliptemplates "https://github.com/mulgundsunil1918/mmcopd/blob/main/src/db/slip-templates.ts"
click node_notifications "https://github.com/mulgundsunil1918/mmcopd/blob/main/src/services/notifications.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_app,node_settings toneBlue
class node_reception,node_appointments,node_doctor,node_ipd,node_lab,node_radiology,node_opdslip toneAmber
class node_billing,node_quickbill,node_billmath,node_pharmacy,node_purchase,node_billreview,node_accounts,node_analytics,node_whatsapp,node_billimport toneMint
class node_main,node_db,node_settingsdb,node_ipc,node_netserver,node_netclient toneRose
class node_auth,node_pharmacymath,node_modal,node_helptip,node_sliptemplates,node_notifications,node_staff toneIndigo
```

## Components

### Application shell

- [App routing](https://github.com/mulgundsunil1918/mmcopd/blob/main/src/App.tsx): `src/App.tsx`
- [Clinic settings](https://github.com/mulgundsunil1918/mmcopd/blob/main/src/pages/Settings.tsx): `src/pages/Settings.tsx`

### Clinic workflows

- [Reception](https://github.com/mulgundsunil1918/mmcopd/blob/main/src/pages/Reception.tsx): `src/pages/Reception.tsx`
- [Appointments](https://github.com/mulgundsunil1918/mmcopd/blob/main/src/pages/Appointments.tsx): `src/pages/Appointments.tsx`
- [Doctor queue](https://github.com/mulgundsunil1918/mmcopd/blob/main/src/pages/DoctorDashboard.tsx): `src/pages/DoctorDashboard.tsx`
- [Inpatient care](https://github.com/mulgundsunil1918/mmcopd/blob/main/src/pages/IPD.tsx): `src/pages/IPD.tsx`
- [Laboratory](https://github.com/mulgundsunil1918/mmcopd/blob/main/src/pages/Lab.tsx): `src/pages/Lab.tsx`
- [Radiology](https://github.com/mulgundsunil1918/mmcopd/blob/main/src/pages/Radiology.tsx): `src/pages/Radiology.tsx`
- [OPD slip](https://github.com/mulgundsunil1918/mmcopd/blob/main/src/components/OpdSlip.tsx): `src/components/OpdSlip.tsx`

### Business operations

- [Billing](https://github.com/mulgundsunil1918/mmcopd/blob/main/src/pages/Billing.tsx): `src/pages/Billing.tsx`
- [Quick bill](https://github.com/mulgundsunil1918/mmcopd/blob/main/src/components/billing/QuickBillModal.tsx): `src/components/billing/QuickBillModal.tsx`
- [Bill calculations](https://github.com/mulgundsunil1918/mmcopd/blob/main/src/main/billing-engine.ts): `src/main/billing-engine.ts`
- [Pharmacy](https://github.com/mulgundsunil1918/mmcopd/blob/main/src/pages/Pharmacy.tsx): `src/pages/Pharmacy.tsx`
- [Purchase entry](https://github.com/mulgundsunil1918/mmcopd/blob/main/src/components/pharmacy/PurchaseBillModal.tsx): `src/components/pharmacy/PurchaseBillModal.tsx`
- [Purchase review](https://github.com/mulgundsunil1918/mmcopd/blob/main/src/components/pharmacy/billImport/ReviewScreen.tsx): `src/components/pharmacy/billImport/ReviewScreen.tsx`
- [Accounts](https://github.com/mulgundsunil1918/mmcopd/blob/main/src/pages/Accounts.tsx): `src/pages/Accounts.tsx`
- [Analytics](https://github.com/mulgundsunil1918/mmcopd/blob/main/src/pages/Analytics.tsx): `src/pages/Analytics.tsx`
- [WhatsApp](https://github.com/mulgundsunil1918/mmcopd/blob/main/src/pages/WhatsApp.tsx): `src/pages/WhatsApp.tsx`
- [Bill import logic](https://github.com/mulgundsunil1918/mmcopd/blob/main/src/lib/billImport/index.ts): `src/lib/billImport/index.ts`

### Desktop and data platform

- [Electron main](https://github.com/mulgundsunil1918/mmcopd/blob/main/src/main.ts): `src/main.ts`
- [SQLite database](https://github.com/mulgundsunil1918/mmcopd/blob/main/src/db/db.ts): `src/db/db.ts`
- [Settings storage](https://github.com/mulgundsunil1918/mmcopd/blob/main/src/db/settings.ts): `src/db/settings.ts`
- [IPC handlers](https://github.com/mulgundsunil1918/mmcopd/blob/main/src/main/ipc.ts): `src/main/ipc.ts`
- [Network host](https://github.com/mulgundsunil1918/mmcopd/blob/main/src/main/network-server.ts): `src/main/network-server.ts`
- [Network proxy](https://github.com/mulgundsunil1918/mmcopd/blob/main/src/main/network-client.ts): `src/main/network-client.ts`

### Shared capabilities

- [Sign-in state](https://github.com/mulgundsunil1918/mmcopd/blob/main/src/hooks/useAuth.tsx): `src/hooks/useAuth.tsx`
- [Pharmacy arithmetic](https://github.com/mulgundsunil1918/mmcopd/blob/main/src/lib/pharmacyMath.ts): `src/lib/pharmacyMath.ts`
- [Modal UI](https://github.com/mulgundsunil1918/mmcopd/blob/main/src/components/Modal.tsx): `src/components/Modal.tsx`
- [Help tips](https://github.com/mulgundsunil1918/mmcopd/blob/main/src/components/HelpTip.tsx): `src/components/HelpTip.tsx`
- [Slip templates](https://github.com/mulgundsunil1918/mmcopd/blob/main/src/db/slip-templates.ts): `src/db/slip-templates.ts`
- [Notifications](https://github.com/mulgundsunil1918/mmcopd/blob/main/src/services/notifications.ts): `src/services/notifications.ts`

### Other components

- **Clinic staff**

## Connections

- Clinic staff → App routing: uses
- App routing → Reception: routes to (evidence: `src/App.tsx`)
- App routing → Appointments: routes to (evidence: `src/App.tsx`)
- App routing → Doctor queue: routes to (evidence: `src/App.tsx`)
- App routing → Billing: routes to (evidence: `src/App.tsx`)
- App routing → Accounts: routes to (evidence: `src/App.tsx`)
- App routing → Analytics: routes to (evidence: `src/App.tsx`)
- App routing → Inpatient care: routes to (evidence: `src/App.tsx`)
- App routing → Laboratory: routes to (evidence: `src/App.tsx`)
- App routing → Radiology: routes to (evidence: `src/App.tsx`)
- App routing → Pharmacy: routes to (evidence: `src/App.tsx`)
- App routing → Clinic settings: routes to (evidence: `src/App.tsx`)
- App routing → WhatsApp: routes to (evidence: `src/App.tsx`)
- Quick bill → Modal UI: renders (evidence: `src/components/billing/QuickBillModal.tsx`)
- Quick bill → Billing: supports
- Purchase entry → Modal UI: uses (evidence: `src/components/pharmacy/PurchaseBillModal.tsx`)
- Purchase entry → Bill import logic: uses (evidence: `src/components/pharmacy/PurchaseBillModal.tsx`)
- Purchase review → Bill import logic: uses (evidence: `src/components/pharmacy/billImport/ReviewScreen.tsx`)
- Purchase entry → Help tips: renders (evidence: `src/components/pharmacy/PurchaseBillModal.tsx`)
- Purchase review → Help tips: renders (evidence: `src/components/pharmacy/billImport/ReviewScreen.tsx`)
- Electron main → SQLite database: gets database (evidence: `src/main.ts`)
- Electron main → Settings storage: reads settings (evidence: `src/main.ts`)
- Electron main → Network host: starts host (evidence: `src/main.ts`)
- Electron main → Network proxy: configures proxy (evidence: `src/main.ts`)
- Electron main → IPC handlers: runs backup (evidence: `src/main.ts`)
- Network proxy → IPC handlers: forwards handlers (evidence: `src/main/network-client.ts`)
- Bill calculations → Pharmacy arithmetic: uses arithmetic (evidence: `src/main/billing-engine.ts`)
- Quick bill → Billing: creates bills
- App routing → Sign-in state: uses session (evidence: `src/App.tsx`)
- OPD slip → Slip templates: uses templates (evidence: `src/components/SlipPreviewLauncher.tsx`)
