# lohit30/healthtech architecture

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

- Interactive diagram: https://gitdiagram.com/lohit30/healthtech
- Repository: https://github.com/lohit30/healthtech

## Overview

RuralCare is a clinic-management and remote-vitals application for patients, doctors, pharmacy staff, and administrators. Users enter through role-aware browser routes; patient and doctor workflows include appointments, clinical records, and monitoring, while administrators manage clinic users and review system status. The frontend calls an Express API backed by SQLite. The source index documents backend route registration and module references, but several page excerpts are incomplete; edges are limited to visible routing, calls, or documented imports, so some likely UI/API integrations are not drawn.

Main entry points: [`backend/src/index.ts`](https://github.com/lohit30/healthtech/blob/main/backend/src/index.ts) (Express API server), [`frontend/src/App.tsx`](https://github.com/lohit30/healthtech/blob/main/frontend/src/App.tsx) (Role-based routing), [`backend/src/db.ts`](https://github.com/lohit30/healthtech/blob/main/backend/src/db.ts) (SQLite clinic data), [`backend/src/middleware/auth.ts`](https://github.com/lohit30/healthtech/blob/main/backend/src/middleware/auth.ts) (JWT role checks)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web application"]
  node_app["Role-based routing<br/>[App.tsx]"]
  node_authui["Browser auth state<br/>[auth.ts]"]
  node_login["Login and registration<br/>[LoginPage.tsx]"]
end

subgraph group_clinical["Clinical workflows"]
  node_patientsui["Patient records UI<br/>[PatientList.tsx]"]
  node_addpatient["Patient intake<br/>[AddPatient.tsx]"]
  node_appointmentsui["Appointment scheduler"]
  node_consultui["Consultation notes UI"]
  node_patientdash["Patient portal"]
  node_doctordash["Doctor workspace"]
  node_vitals["Vitals polling<br/>[useVitals.ts]"]
  node_risk["Risk and alerts<br/>[vitalsUtils.ts]"]
  node_vitalscard["Vitals display<br/>[VitalsCard.tsx]"]
end

subgraph group_admin["Clinic administration"]
  node_admindash["Administration dashboard<br/>[AdminDashboard.tsx]"]
  node_pharmacydash["Pharmacy dashboard"]
end

subgraph group_api["API services"]
  node_server["Express API server<br/>[index.ts]"]
  node_authroute["Authentication routes<br/>[auth.ts]"]
  node_patientroute["Patient routes<br/>[patients.ts]"]
  node_appointmentroute["Appointment routes<br/>[appointments.ts]"]
  node_consultroute["Consultation routes<br/>[consultations.ts]"]
  node_vitalsroute["Vitals routes<br/>[vitals.ts]"]
  node_adminroute["Admin routes<br/>[admin.ts]"]
  node_availabilityroute["Availability routes<br/>[availability.ts]"]
  node_doctorroute["Doctor routes<br/>[doctors.ts]"]
  node_medicineroute["Medicine routes<br/>[medicines.ts]"]
  node_prescriptionroute["Prescription routes<br/>[prescriptions.ts]"]
  node_reportsroute["Report routes<br/>[reports.ts]"]
end

subgraph group_core["Identity and storage"]
  node_middleware["JWT role checks<br/>[auth.ts]"]
  node_database[("SQLite clinic data<br/>[db.ts]")]
end

node_user(("Clinic user"))

node_user -->|"uses"| node_app
node_app -->|"checks session"| node_authui
node_app -->|"routes to"| node_login
node_app -->|"routes to"| node_patientsui
node_app -->|"routes to"| node_addpatient
node_app -->|"routes to"| node_appointmentsui
node_app -->|"routes to"| node_consultui
node_app -->|"routes to"| node_patientdash
node_app -->|"routes to"| node_doctordash
node_app -->|"routes to"| node_admindash
node_app -->|"routes to"| node_pharmacydash
node_server -->|"mounts routes"| node_patientroute
node_server -->|"mounts routes"| node_appointmentroute
node_server -->|"mounts routes"| node_consultroute
node_server -->|"mounts routes"| node_doctorroute
node_server -->|"mounts routes"| node_authroute
node_server -->|"mounts routes"| node_adminroute
node_server -->|"mounts routes"| node_availabilityroute
node_server -->|"mounts routes"| node_vitalsroute
node_server -->|"mounts routes"| node_medicineroute
node_server -->|"mounts routes"| node_prescriptionroute
node_server -->|"mounts routes"| node_reportsroute
node_authroute -->|"reads and writes"| node_database
node_authroute -->|"uses JWT secret"| node_middleware
node_patientroute -->|"reads and writes"| node_database
node_appointmentroute -->|"reads and writes"| node_database
node_appointmentroute -->|"uses auth"| node_middleware
node_consultroute -->|"reads and writes"| node_database
node_vitalsroute -->|"reads and writes"| node_database
node_vitalsroute -->|"uses auth"| node_middleware
node_adminroute -->|"reads and writes"| node_database
node_adminroute -->|"uses auth"| node_middleware
node_availabilityroute -->|"reads and writes"| node_database
node_availabilityroute -->|"uses auth"| node_middleware
node_doctorroute -->|"reads and writes"| node_database
node_medicineroute -->|"reads and writes"| node_database
node_medicineroute -->|"uses auth"| node_middleware
node_prescriptionroute -->|"reads and writes"| node_database
node_prescriptionroute -->|"uses auth"| node_middleware
node_reportsroute -->|"reads and writes"| node_database
node_reportsroute -->|"uses auth"| node_middleware
node_patientdash -->|"polls own vitals"| node_vitals
node_doctordash -->|"loads monitoring"| node_vitals
node_admindash -->|"loads monitoring"| node_vitals
node_vitals -->|"fetches vitals"| node_vitalsroute
node_vitals -->|"derives alerts"| node_risk
node_doctordash -->|"submits notes"| node_consultroute
node_doctordash -->|"manages slots"| node_availabilityroute

click node_app "https://github.com/lohit30/healthtech/blob/main/frontend/src/App.tsx"
click node_authui "https://github.com/lohit30/healthtech/blob/main/frontend/src/auth.ts"
click node_login "https://github.com/lohit30/healthtech/blob/main/frontend/src/pages/LoginPage.tsx"
click node_patientsui "https://github.com/lohit30/healthtech/blob/main/frontend/src/pages/PatientList.tsx"
click node_addpatient "https://github.com/lohit30/healthtech/blob/main/frontend/src/pages/AddPatient.tsx"
click node_appointmentsui "https://github.com/lohit30/healthtech/blob/main/frontend/src/pages/AppointmentScheduler.tsx"
click node_consultui "https://github.com/lohit30/healthtech/blob/main/frontend/src/pages/ConsultationNotes.tsx"
click node_patientdash "https://github.com/lohit30/healthtech/blob/main/frontend/src/pages/patient/PatientDashboard.tsx"
click node_doctordash "https://github.com/lohit30/healthtech/blob/main/frontend/src/pages/doctor/DoctorDashboard.tsx"
click node_vitals "https://github.com/lohit30/healthtech/blob/main/frontend/src/hooks/useVitals.ts"
click node_risk "https://github.com/lohit30/healthtech/blob/main/frontend/src/utils/vitalsUtils.ts"
click node_vitalscard "https://github.com/lohit30/healthtech/blob/main/frontend/src/components/VitalsCard.tsx"
click node_admindash "https://github.com/lohit30/healthtech/blob/main/frontend/src/pages/admin/AdminDashboard.tsx"
click node_pharmacydash "https://github.com/lohit30/healthtech/blob/main/frontend/src/pages/pharmacy/PharmacyDashboard.tsx"
click node_server "https://github.com/lohit30/healthtech/blob/main/backend/src/index.ts"
click node_authroute "https://github.com/lohit30/healthtech/blob/main/backend/src/routes/auth.ts"
click node_patientroute "https://github.com/lohit30/healthtech/blob/main/backend/src/routes/patients.ts"
click node_appointmentroute "https://github.com/lohit30/healthtech/blob/main/backend/src/routes/appointments.ts"
click node_consultroute "https://github.com/lohit30/healthtech/blob/main/backend/src/routes/consultations.ts"
click node_vitalsroute "https://github.com/lohit30/healthtech/blob/main/backend/src/routes/vitals.ts"
click node_adminroute "https://github.com/lohit30/healthtech/blob/main/backend/src/routes/admin.ts"
click node_availabilityroute "https://github.com/lohit30/healthtech/blob/main/backend/src/routes/availability.ts"
click node_doctorroute "https://github.com/lohit30/healthtech/blob/main/backend/src/routes/doctors.ts"
click node_medicineroute "https://github.com/lohit30/healthtech/blob/main/backend/src/routes/medicines.ts"
click node_prescriptionroute "https://github.com/lohit30/healthtech/blob/main/backend/src/routes/prescriptions.ts"
click node_reportsroute "https://github.com/lohit30/healthtech/blob/main/backend/src/routes/reports.ts"
click node_middleware "https://github.com/lohit30/healthtech/blob/main/backend/src/middleware/auth.ts"
click node_database "https://github.com/lohit30/healthtech/blob/main/backend/src/db.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_login,node_user toneBlue
class node_patientsui,node_addpatient,node_appointmentsui,node_consultui,node_patientdash,node_doctordash,node_vitals,node_risk,node_vitalscard toneAmber
class node_admindash,node_pharmacydash toneMint
class node_server,node_authroute,node_patientroute,node_appointmentroute,node_consultroute,node_vitalsroute,node_adminroute,node_availabilityroute,node_doctorroute,node_medicineroute,node_prescriptionroute,node_reportsroute toneRose
class node_middleware,node_database toneIndigo
```

## Components

### Web application

- [Role-based routing](https://github.com/lohit30/healthtech/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Browser auth state](https://github.com/lohit30/healthtech/blob/main/frontend/src/auth.ts): `frontend/src/auth.ts`
- [Login and registration](https://github.com/lohit30/healthtech/blob/main/frontend/src/pages/LoginPage.tsx): `frontend/src/pages/LoginPage.tsx`

### Clinical workflows

- [Patient records UI](https://github.com/lohit30/healthtech/blob/main/frontend/src/pages/PatientList.tsx): `frontend/src/pages/PatientList.tsx`
- [Patient intake](https://github.com/lohit30/healthtech/blob/main/frontend/src/pages/AddPatient.tsx): `frontend/src/pages/AddPatient.tsx`
- [Appointment scheduler](https://github.com/lohit30/healthtech/blob/main/frontend/src/pages/AppointmentScheduler.tsx): `frontend/src/pages/AppointmentScheduler.tsx`
- [Consultation notes UI](https://github.com/lohit30/healthtech/blob/main/frontend/src/pages/ConsultationNotes.tsx): `frontend/src/pages/ConsultationNotes.tsx`
- [Patient portal](https://github.com/lohit30/healthtech/blob/main/frontend/src/pages/patient/PatientDashboard.tsx): `frontend/src/pages/patient/PatientDashboard.tsx`
- [Doctor workspace](https://github.com/lohit30/healthtech/blob/main/frontend/src/pages/doctor/DoctorDashboard.tsx): `frontend/src/pages/doctor/DoctorDashboard.tsx`
- [Vitals polling](https://github.com/lohit30/healthtech/blob/main/frontend/src/hooks/useVitals.ts): `frontend/src/hooks/useVitals.ts`
- [Risk and alerts](https://github.com/lohit30/healthtech/blob/main/frontend/src/utils/vitalsUtils.ts): `frontend/src/utils/vitalsUtils.ts`
- [Vitals display](https://github.com/lohit30/healthtech/blob/main/frontend/src/components/VitalsCard.tsx): `frontend/src/components/VitalsCard.tsx`

### Clinic administration

- [Administration dashboard](https://github.com/lohit30/healthtech/blob/main/frontend/src/pages/admin/AdminDashboard.tsx): `frontend/src/pages/admin/AdminDashboard.tsx`
- [Pharmacy dashboard](https://github.com/lohit30/healthtech/blob/main/frontend/src/pages/pharmacy/PharmacyDashboard.tsx): `frontend/src/pages/pharmacy/PharmacyDashboard.tsx`

### API services

- [Express API server](https://github.com/lohit30/healthtech/blob/main/backend/src/index.ts): `backend/src/index.ts`
- [Authentication routes](https://github.com/lohit30/healthtech/blob/main/backend/src/routes/auth.ts): `backend/src/routes/auth.ts`
- [Patient routes](https://github.com/lohit30/healthtech/blob/main/backend/src/routes/patients.ts): `backend/src/routes/patients.ts`
- [Appointment routes](https://github.com/lohit30/healthtech/blob/main/backend/src/routes/appointments.ts): `backend/src/routes/appointments.ts`
- [Consultation routes](https://github.com/lohit30/healthtech/blob/main/backend/src/routes/consultations.ts): `backend/src/routes/consultations.ts`
- [Vitals routes](https://github.com/lohit30/healthtech/blob/main/backend/src/routes/vitals.ts): `backend/src/routes/vitals.ts`
- [Admin routes](https://github.com/lohit30/healthtech/blob/main/backend/src/routes/admin.ts): `backend/src/routes/admin.ts`
- [Availability routes](https://github.com/lohit30/healthtech/blob/main/backend/src/routes/availability.ts): `backend/src/routes/availability.ts`
- [Doctor routes](https://github.com/lohit30/healthtech/blob/main/backend/src/routes/doctors.ts): `backend/src/routes/doctors.ts`
- [Medicine routes](https://github.com/lohit30/healthtech/blob/main/backend/src/routes/medicines.ts): `backend/src/routes/medicines.ts`
- [Prescription routes](https://github.com/lohit30/healthtech/blob/main/backend/src/routes/prescriptions.ts): `backend/src/routes/prescriptions.ts`
- [Report routes](https://github.com/lohit30/healthtech/blob/main/backend/src/routes/reports.ts): `backend/src/routes/reports.ts`

### Identity and storage

- [JWT role checks](https://github.com/lohit30/healthtech/blob/main/backend/src/middleware/auth.ts): `backend/src/middleware/auth.ts`
- [SQLite clinic data](https://github.com/lohit30/healthtech/blob/main/backend/src/db.ts): `backend/src/db.ts`

### Other components

- **Clinic user**

## Connections

- Clinic user → Role-based routing: uses
- Role-based routing → Browser auth state: checks session (evidence: `frontend/src/App.tsx`)
- Role-based routing → Login and registration: routes to (evidence: `frontend/src/App.tsx`)
- Role-based routing → Patient records UI: routes to (evidence: `frontend/src/App.tsx`)
- Role-based routing → Patient intake: routes to (evidence: `frontend/src/App.tsx`)
- Role-based routing → Appointment scheduler: routes to (evidence: `frontend/src/App.tsx`)
- Role-based routing → Consultation notes UI: routes to (evidence: `frontend/src/App.tsx`)
- Role-based routing → Patient portal: routes to (evidence: `frontend/src/App.tsx`)
- Role-based routing → Doctor workspace: routes to (evidence: `frontend/src/App.tsx`)
- Role-based routing → Administration dashboard: routes to (evidence: `frontend/src/App.tsx`)
- Role-based routing → Pharmacy dashboard: routes to (evidence: `frontend/src/App.tsx`)
- Express API server → Patient routes: mounts routes (evidence: `backend/src/index.ts`)
- Express API server → Appointment routes: mounts routes (evidence: `backend/src/index.ts`)
- Express API server → Consultation routes: mounts routes (evidence: `backend/src/index.ts`)
- Express API server → Doctor routes: mounts routes (evidence: `backend/src/index.ts`)
- Express API server → Authentication routes: mounts routes (evidence: `backend/src/index.ts`)
- Express API server → Admin routes: mounts routes (evidence: `backend/src/index.ts`)
- Express API server → Availability routes: mounts routes (evidence: `backend/src/index.ts`)
- Express API server → Vitals routes: mounts routes (evidence: `backend/src/index.ts`)
- Express API server → Medicine routes: mounts routes (evidence: `backend/src/index.ts`)
- Express API server → Prescription routes: mounts routes (evidence: `backend/src/index.ts`)
- Express API server → Report routes: mounts routes (evidence: `backend/src/index.ts`)
- Authentication routes → SQLite clinic data: reads and writes (evidence: `backend/src/routes/auth.ts`)
- Authentication routes → JWT role checks: uses JWT secret (evidence: `backend/src/routes/auth.ts`)
- Patient routes → SQLite clinic data: reads and writes (evidence: `backend/src/routes/patients.ts`)
- Appointment routes → SQLite clinic data: reads and writes (evidence: `backend/src/routes/appointments.ts`)
- Appointment routes → JWT role checks: uses auth (evidence: `backend/src/routes/appointments.ts`)
- Consultation routes → SQLite clinic data: reads and writes (evidence: `backend/src/routes/consultations.ts`)
- Vitals routes → SQLite clinic data: reads and writes (evidence: `backend/src/routes/vitals.ts`)
- Vitals routes → JWT role checks: uses auth (evidence: `backend/src/routes/vitals.ts`)
- Admin routes → SQLite clinic data: reads and writes (evidence: `backend/src/routes/admin.ts`)
- Admin routes → JWT role checks: uses auth (evidence: `backend/src/routes/admin.ts`)
- Availability routes → SQLite clinic data: reads and writes (evidence: `backend/src/routes/availability.ts`)
- Availability routes → JWT role checks: uses auth (evidence: `backend/src/routes/availability.ts`)
- Doctor routes → SQLite clinic data: reads and writes (evidence: `backend/src/routes/doctors.ts`)
- Medicine routes → SQLite clinic data: reads and writes (evidence: `backend/src/routes/medicines.ts`)
- Medicine routes → JWT role checks: uses auth (evidence: `backend/src/routes/medicines.ts`)
- Prescription routes → SQLite clinic data: reads and writes (evidence: `backend/src/routes/prescriptions.ts`)
- Prescription routes → JWT role checks: uses auth (evidence: `backend/src/routes/prescriptions.ts`)
- Report routes → SQLite clinic data: reads and writes (evidence: `backend/src/routes/reports.ts`)
- Report routes → JWT role checks: uses auth (evidence: `backend/src/routes/reports.ts`)
- Patient portal → Vitals polling: polls own vitals (evidence: `frontend/src/pages/patient/PatientDashboard.tsx`)
- Doctor workspace → Vitals polling: loads monitoring (evidence: `frontend/src/pages/doctor/DoctorDashboard.tsx`)
- Administration dashboard → Vitals polling: loads monitoring (evidence: `frontend/src/pages/admin/AdminDashboard.tsx`)
- Vitals polling → Vitals routes: fetches vitals (evidence: `frontend/src/hooks/useVitals.ts`)
- Vitals polling → Risk and alerts: derives alerts (evidence: `frontend/src/hooks/useVitals.ts`)
- Doctor workspace → Consultation routes: submits notes (evidence: `frontend/src/pages/doctor/DoctorDashboard.tsx`)
- Doctor workspace → Availability routes: manages slots (evidence: `frontend/src/pages/doctor/DoctorDashboard.tsx`)
