# sukrerohit0409/integrated-hospital-management-system architecture

> Architecture diagram of the GitHub repository sukrerohit0409/integrated-hospital-management-system, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-24). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sukrerohit0409/integrated-hospital-management-system
- Repository: https://github.com/sukrerohit0409/integrated-hospital-management-system

## Overview

PulseCare IHMS is a role-based hospital management web app. Patients book appointments; staff handle registration, queues, consultation, prescriptions, billing, and attendance, while managers and admins oversee staff and finances. App.tsx resolves sessions and role-authorized workspace routes before displaying dashboards. Dashboards use a shared store, backed by browser-local demo data or Supabase records and realtime refreshes. The graph preserves documented billing, leave, analytics, and appointment capabilities. Some dashboard internals and API wiring were not sampled, so edges are limited to shown imports, calls, and README statements.

Main entry points: [`src/App.tsx`](https://github.com/sukrerohit0409/integrated-hospital-management-system/blob/main/src/App.tsx) (App router), [`src/data/store.ts`](https://github.com/sukrerohit0409/integrated-hospital-management-system/blob/main/src/data/store.ts) (Shared records), [`src/components/LoginModal.tsx`](https://github.com/sukrerohit0409/integrated-hospital-management-system/blob/main/src/components/LoginModal.tsx) (Login modal), [`src/components/patient/PatientDashboard.tsx`](https://github.com/sukrerohit0409/integrated-hospital-management-system/blob/main/src/components/patient/PatientDashboard.tsx) (Patient portal)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["App entry and access"]
  node_app["App router<br/>[App.tsx]"]
  node_authui["Login modal<br/>[LoginModal.tsx]"]
  node_routes["Workspace access<br/>[workspaceRoutes.ts]"]
  node_authdata["Auth profile<br/>[auth.ts]"]
end

subgraph group_care["Care workflows"]
  node_patient["Patient portal"]
  node_reception["Reception desk"]
  node_doctor["Doctor portal"]
  node_prescription["Prescription print"]
end

subgraph group_operations["Hospital operations"]
  node_admin["Admin dashboard<br/>[AdminDashboard.tsx]"]
  node_manager["Manager dashboard"]
  node_staff["Staff portal<br/>[StaffDashboard.tsx]"]
  node_attendance["Attendance marker"]
  node_staffaccounts["Staff accounts<br/>[staffAccounts.ts]"]
end

subgraph group_data["Shared data and services"]
  node_store[("Shared records<br/>[store.ts]")]
  node_supabase["Supabase client<br/>[supabase.ts]"]
  node_database[("Supabase database")]
  node_api_staff["Staff API<br/>[staff.ts]"]
  node_api_login["Phone login API<br/>[auth-login.ts]"]
end

subgraph group_logic["Shared domain logic"]
  node_sort["Appointment sorting"]
  node_shifts["Shift rules<br/>[staffShifts.ts]"]
  node_hospitaldate["Hospital dates<br/>[hospitalDate.ts]"]
  node_datehook["Hospital date hook<br/>[useHospitalDate.ts]"]
  node_tabhook["Workspace tab hook<br/>[useWorkspaceTab.ts]"]
  node_validation["Input validation<br/>[validation.ts]"]
  node_phoneinput["Phone input"]
  node_display["User display<br/>[userDisplay.ts]"]
end

node_user(("Hospital user"))

node_user -->|"opens app"| node_app
node_app -->|"loads profile"| node_authdata
node_app -->|"initializes sync"| node_store
node_app -->|"checks access"| node_routes
node_app -->|"opens login"| node_authui
node_app -->|"renders portal"| node_patient
node_app -->|"renders portal"| node_reception
node_app -->|"renders portal"| node_doctor
node_app -->|"renders portal"| node_admin
node_app -->|"renders portal"| node_manager
node_app -->|"renders portal"| node_staff
node_authui -->|"collects phone"| node_phoneinput
node_authui -->|"validates input"| node_validation
node_authui -->|"resolves phone"| node_api_login
node_patient -->|"reads and writes"| node_store
node_reception -->|"reads and writes"| node_store
node_doctor -->|"reads and writes"| node_store
node_doctor -->|"opens print"| node_prescription
node_manager -->|"manages accounts"| node_staffaccounts
node_staff -.->|"records attendance"| node_attendance
node_store -->|"persists records"| node_supabase
node_supabase -->|"reads and writes"| node_database
node_patient -->|"sorts appointments"| node_sort
node_reception -->|"sorts appointments"| node_sort
node_store -->|"calculates checkout"| node_shifts
node_datehook -->|"gets hospital date"| node_hospitaldate
node_patient -->|"syncs workspace tab"| node_tabhook
node_phoneinput -->|"normalizes phone"| node_validation
node_store -->|"formats profile name"| node_display
node_manager -.->|"invites staff"| node_api_staff

click node_app "https://github.com/sukrerohit0409/integrated-hospital-management-system/blob/main/src/App.tsx"
click node_authui "https://github.com/sukrerohit0409/integrated-hospital-management-system/blob/main/src/components/LoginModal.tsx"
click node_routes "https://github.com/sukrerohit0409/integrated-hospital-management-system/blob/main/src/utils/workspaceRoutes.ts"
click node_authdata "https://github.com/sukrerohit0409/integrated-hospital-management-system/blob/main/src/data/auth.ts"
click node_patient "https://github.com/sukrerohit0409/integrated-hospital-management-system/blob/main/src/components/patient/PatientDashboard.tsx"
click node_reception "https://github.com/sukrerohit0409/integrated-hospital-management-system/blob/main/src/components/receptionist/ReceptionistDashboard.tsx"
click node_doctor "https://github.com/sukrerohit0409/integrated-hospital-management-system/blob/main/src/components/doctor/DoctorDashboard.tsx"
click node_prescription "https://github.com/sukrerohit0409/integrated-hospital-management-system/blob/main/src/components/PrintPrescriptionModal.tsx"
click node_admin "https://github.com/sukrerohit0409/integrated-hospital-management-system/blob/main/src/components/admin/AdminDashboard.tsx"
click node_manager "https://github.com/sukrerohit0409/integrated-hospital-management-system/blob/main/src/components/manager/ManagerDashboard.tsx"
click node_staff "https://github.com/sukrerohit0409/integrated-hospital-management-system/blob/main/src/components/staff/StaffDashboard.tsx"
click node_attendance "https://github.com/sukrerohit0409/integrated-hospital-management-system/blob/main/src/components/AttendanceMarker.tsx"
click node_staffaccounts "https://github.com/sukrerohit0409/integrated-hospital-management-system/blob/main/src/data/staffAccounts.ts"
click node_store "https://github.com/sukrerohit0409/integrated-hospital-management-system/blob/main/src/data/store.ts"
click node_supabase "https://github.com/sukrerohit0409/integrated-hospital-management-system/blob/main/src/lib/supabase.ts"
click node_api_staff "https://github.com/sukrerohit0409/integrated-hospital-management-system/blob/main/api/staff.ts"
click node_api_login "https://github.com/sukrerohit0409/integrated-hospital-management-system/blob/main/api/auth-login.ts"
click node_sort "https://github.com/sukrerohit0409/integrated-hospital-management-system/blob/main/src/utils/appointmentSorting.ts"
click node_shifts "https://github.com/sukrerohit0409/integrated-hospital-management-system/blob/main/src/utils/staffShifts.ts"
click node_hospitaldate "https://github.com/sukrerohit0409/integrated-hospital-management-system/blob/main/src/utils/hospitalDate.ts"
click node_datehook "https://github.com/sukrerohit0409/integrated-hospital-management-system/blob/main/src/hooks/useHospitalDate.ts"
click node_tabhook "https://github.com/sukrerohit0409/integrated-hospital-management-system/blob/main/src/hooks/useWorkspaceTab.ts"
click node_validation "https://github.com/sukrerohit0409/integrated-hospital-management-system/blob/main/src/utils/validation.ts"
click node_phoneinput "https://github.com/sukrerohit0409/integrated-hospital-management-system/blob/main/src/components/IndianPhoneInput.tsx"
click node_display "https://github.com/sukrerohit0409/integrated-hospital-management-system/blob/main/src/utils/userDisplay.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_authui,node_routes,node_authdata,node_user toneBlue
class node_patient,node_reception,node_doctor,node_prescription toneAmber
class node_admin,node_manager,node_staff,node_attendance,node_staffaccounts toneMint
class node_store,node_supabase,node_database,node_api_staff,node_api_login toneRose
class node_sort,node_shifts,node_hospitaldate,node_datehook,node_tabhook,node_validation,node_phoneinput,node_display toneIndigo
```

## Components

### App entry and access

- [App router](https://github.com/sukrerohit0409/integrated-hospital-management-system/blob/main/src/App.tsx): `src/App.tsx`
- [Login modal](https://github.com/sukrerohit0409/integrated-hospital-management-system/blob/main/src/components/LoginModal.tsx): `src/components/LoginModal.tsx`
- [Workspace access](https://github.com/sukrerohit0409/integrated-hospital-management-system/blob/main/src/utils/workspaceRoutes.ts): `src/utils/workspaceRoutes.ts`
- [Auth profile](https://github.com/sukrerohit0409/integrated-hospital-management-system/blob/main/src/data/auth.ts): `src/data/auth.ts`

### Care workflows

- [Patient portal](https://github.com/sukrerohit0409/integrated-hospital-management-system/blob/main/src/components/patient/PatientDashboard.tsx): `src/components/patient/PatientDashboard.tsx`
- [Reception desk](https://github.com/sukrerohit0409/integrated-hospital-management-system/blob/main/src/components/receptionist/ReceptionistDashboard.tsx): `src/components/receptionist/ReceptionistDashboard.tsx`
- [Doctor portal](https://github.com/sukrerohit0409/integrated-hospital-management-system/blob/main/src/components/doctor/DoctorDashboard.tsx): `src/components/doctor/DoctorDashboard.tsx`
- [Prescription print](https://github.com/sukrerohit0409/integrated-hospital-management-system/blob/main/src/components/PrintPrescriptionModal.tsx): `src/components/PrintPrescriptionModal.tsx`

### Hospital operations

- [Admin dashboard](https://github.com/sukrerohit0409/integrated-hospital-management-system/blob/main/src/components/admin/AdminDashboard.tsx): `src/components/admin/AdminDashboard.tsx`
- [Manager dashboard](https://github.com/sukrerohit0409/integrated-hospital-management-system/blob/main/src/components/manager/ManagerDashboard.tsx): `src/components/manager/ManagerDashboard.tsx`
- [Staff portal](https://github.com/sukrerohit0409/integrated-hospital-management-system/blob/main/src/components/staff/StaffDashboard.tsx): `src/components/staff/StaffDashboard.tsx`
- [Attendance marker](https://github.com/sukrerohit0409/integrated-hospital-management-system/blob/main/src/components/AttendanceMarker.tsx): `src/components/AttendanceMarker.tsx`
- [Staff accounts](https://github.com/sukrerohit0409/integrated-hospital-management-system/blob/main/src/data/staffAccounts.ts): `src/data/staffAccounts.ts`

### Shared data and services

- [Shared records](https://github.com/sukrerohit0409/integrated-hospital-management-system/blob/main/src/data/store.ts): `src/data/store.ts`
- [Supabase client](https://github.com/sukrerohit0409/integrated-hospital-management-system/blob/main/src/lib/supabase.ts): `src/lib/supabase.ts`
- **Supabase database**
- [Staff API](https://github.com/sukrerohit0409/integrated-hospital-management-system/blob/main/api/staff.ts): `api/staff.ts`
- [Phone login API](https://github.com/sukrerohit0409/integrated-hospital-management-system/blob/main/api/auth-login.ts): `api/auth-login.ts`

### Shared domain logic

- [Appointment sorting](https://github.com/sukrerohit0409/integrated-hospital-management-system/blob/main/src/utils/appointmentSorting.ts): `src/utils/appointmentSorting.ts`
- [Shift rules](https://github.com/sukrerohit0409/integrated-hospital-management-system/blob/main/src/utils/staffShifts.ts): `src/utils/staffShifts.ts`
- [Hospital dates](https://github.com/sukrerohit0409/integrated-hospital-management-system/blob/main/src/utils/hospitalDate.ts): `src/utils/hospitalDate.ts`
- [Hospital date hook](https://github.com/sukrerohit0409/integrated-hospital-management-system/blob/main/src/hooks/useHospitalDate.ts): `src/hooks/useHospitalDate.ts`
- [Workspace tab hook](https://github.com/sukrerohit0409/integrated-hospital-management-system/blob/main/src/hooks/useWorkspaceTab.ts): `src/hooks/useWorkspaceTab.ts`
- [Input validation](https://github.com/sukrerohit0409/integrated-hospital-management-system/blob/main/src/utils/validation.ts): `src/utils/validation.ts`
- [Phone input](https://github.com/sukrerohit0409/integrated-hospital-management-system/blob/main/src/components/IndianPhoneInput.tsx): `src/components/IndianPhoneInput.tsx`
- [User display](https://github.com/sukrerohit0409/integrated-hospital-management-system/blob/main/src/utils/userDisplay.ts): `src/utils/userDisplay.ts`

### Other components

- **Hospital user**

## Connections

- Hospital user → App router: opens app (evidence: `README.md`)
- App router → Auth profile: loads profile (evidence: `src/App.tsx`)
- App router → Shared records: initializes sync (evidence: `src/App.tsx`)
- App router → Workspace access: checks access (evidence: `src/App.tsx`)
- App router → Login modal: opens login (evidence: `src/App.tsx`)
- App router → Patient portal: renders portal (evidence: `src/App.tsx`)
- App router → Reception desk: renders portal (evidence: `src/App.tsx`)
- App router → Doctor portal: renders portal (evidence: `src/App.tsx`)
- App router → Admin dashboard: renders portal (evidence: `src/App.tsx`)
- App router → Manager dashboard: renders portal (evidence: `src/App.tsx`)
- App router → Staff portal: renders portal (evidence: `src/App.tsx`)
- Login modal → Phone input: collects phone (evidence: `src/components/LoginModal.tsx`)
- Login modal → Input validation: validates input (evidence: `src/components/LoginModal.tsx`)
- Login modal → Phone login API: resolves phone (evidence: `README.md`)
- Patient portal → Shared records: reads and writes (evidence: `src/components/patient/PatientDashboard.tsx`)
- Reception desk → Shared records: reads and writes (evidence: `src/components/receptionist/ReceptionistDashboard.tsx`)
- Doctor portal → Shared records: reads and writes (evidence: `src/components/doctor/DoctorDashboard.tsx`)
- Doctor portal → Prescription print: opens print (evidence: `src/components/doctor/DoctorDashboard.tsx`)
- Manager dashboard → Staff accounts: manages accounts (evidence: `src/components/manager/ManagerDashboard.tsx`)
- Staff portal → Attendance marker: records attendance
- Shared records → Supabase client: persists records (evidence: `src/data/store.ts`)
- Supabase client → Supabase database: reads and writes (evidence: `README.md`)
- Patient portal → Appointment sorting: sorts appointments (evidence: `src/components/patient/PatientDashboard.tsx`)
- Reception desk → Appointment sorting: sorts appointments (evidence: `src/components/receptionist/ReceptionistDashboard.tsx`)
- Shared records → Shift rules: calculates checkout (evidence: `src/data/store.ts`)
- Hospital date hook → Hospital dates: gets hospital date (evidence: `src/hooks/useHospitalDate.ts`)
- Patient portal → Workspace tab hook: syncs workspace tab (evidence: `src/components/patient/PatientDashboard.tsx`)
- Phone input → Input validation: normalizes phone (evidence: `src/components/IndianPhoneInput.tsx`)
- Shared records → User display: formats profile name (evidence: `src/data/store.ts`)
- Manager dashboard → Staff API: invites staff
