# harshtyagi334/vactrack architecture

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

- Interactive diagram: https://gitdiagram.com/harshtyagi334/vactrack
- Repository: https://github.com/harshtyagi334/vactrack

## Overview

VacTrack is a React healthcare-record and vaccination-tracking demo with patient and clinic portals. Users register or log in, manage vaccination schedules and records, and clinics search patients and record doses; the shared Zustand store holds demo state and supports hash integrity and reminder generation. Other branches cover hospital operations, nearby and emergency care, medicine/batch verification, and government-benefit discovery. The README describes demo-data limitations and future integrations. Unsampled feature paths are included where documented, but their internal calls are not inferred.

Main entry points: [`src/pages/PatientPages.tsx`](https://github.com/harshtyagi334/vactrack/blob/main/src/pages/PatientPages.tsx) (Patient portal routes), [`src/store/index.ts`](https://github.com/harshtyagi334/vactrack/blob/main/src/store/index.ts) (Persisted application state), [`src/components/GovernmentSchemes/GovernmentSchemesDiscovery.tsx`](https://github.com/harshtyagi334/vactrack/blob/main/src/components/GovernmentSchemes/GovernmentSchemesDiscovery.tsx) (Scheme discovery), [`src/App.tsx`](https://github.com/harshtyagi334/vactrack/blob/main/src/App.tsx) (Route application)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["App entry and access"]
  node_app["Route application<br/>[App.tsx]"]
  node_auth["Authentication<br/>[AuthPages.tsx]"]
end

subgraph group_patient["Patient care"]
  node_patient_routes["Patient portal routes<br/>[PatientPages.tsx]"]
  node_patient_dashboard["Patient dashboard"]
  node_health_record["Health record"]
  node_schedule["Rabies PEP schedule"]
  node_notifications["Reminders and alerts"]
  node_nearby["Nearby hospitals"]
  node_emergency["Emergency care"]
  node_export["Vaccination report export"]
end

subgraph group_clinic["Clinic operations"]
  node_clinic_routes["Clinic portal routes<br/>[ClinicPages.tsx]"]
  node_clinic_dashboard["Clinic dashboard"]
  node_patient_search["Cross-clinic patient search"]
  node_patient_record["Clinic patient record<br/>[PatientRecord.tsx]"]
  node_inventory["Vaccine inventory"]
  node_doctors["Doctor availability"]
  node_ambulance["Ambulance monitoring"]
  node_reviews["Hospital reviews"]
end

subgraph group_benefits["Benefits and verification"]
  node_schemes["Scheme discovery"]
  node_eligibility["Eligibility guidance"]
  node_scheme_detail["Scheme details"]
  node_scheme_hospitals["Empanelled hospitals"]
  node_scheme_data["Scheme reference data"]
  node_medicine_verify["Medicine and batch verification"]
end

subgraph group_core["Shared application core"]
  node_shared_store["Persisted application state<br/>[index.ts]"]
  node_hash["Hash-chain integrity<br/>[hash.ts]"]
  node_reminder_engine["Reminder calculation<br/>[reminderEngine.ts]"]
  node_public_verify["Public record verification"]
end

node_patient_actor(("Patient"))
node_clinic_actor(("Clinic staff"))

node_patient_actor -->|"registers or logs in"| node_auth
node_clinic_actor -->|"registers or logs in"| node_auth
node_app -->|"routes to"| node_auth
node_app -->|"protects patient routes"| node_patient_routes
node_app -->|"protects clinic routes"| node_clinic_routes
node_app -->|"routes to"| node_public_verify
node_patient_routes -->|"renders"| node_patient_dashboard
node_patient_routes -->|"renders"| node_health_record
node_patient_routes -->|"renders"| node_schedule
node_patient_routes -->|"renders"| node_notifications
node_patient_routes -->|"renders"| node_nearby
node_patient_routes -->|"renders"| node_emergency
node_patient_routes -->|"renders"| node_export
node_patient_routes -->|"reads and updates"| node_shared_store
node_clinic_routes -->|"renders"| node_clinic_dashboard
node_clinic_routes -->|"renders"| node_patient_record
node_clinic_routes -->|"reads and updates"| node_shared_store
node_clinic_actor -.->|"searches patients"| node_patient_search
node_clinic_actor -.->|"manages stock"| node_inventory
node_clinic_actor -.->|"updates availability"| node_doctors
node_clinic_actor -.->|"monitors status"| node_ambulance
node_patient_record -->|"reads and updates"| node_shared_store
node_inventory -->|"reads and updates"| node_shared_store
node_ambulance -->|"reads and updates"| node_shared_store
node_reviews -->|"reads and updates"| node_shared_store
node_patient_actor -.->|"uses portal"| node_patient_routes
node_patient_actor -->|"discovers benefits"| node_schemes
node_patient_routes -->|"renders"| node_schemes
node_schemes -->|"opens guidance"| node_eligibility
node_schemes -->|"opens details"| node_scheme_detail
node_schemes -->|"opens hospitals"| node_scheme_hospitals
node_schemes -->|"filters and displays"| node_scheme_data
node_eligibility -->|"uses scheme data"| node_scheme_data
node_scheme_detail -->|"displays scheme data"| node_scheme_data
node_scheme_hospitals -->|"reads network data"| node_scheme_data
node_patient_actor -.->|"checks vaccine batch"| node_medicine_verify
node_patient_routes -->|"renders"| node_medicine_verify
node_auth -.->|"authenticates account"| node_shared_store
node_shared_store -->|"creates and checks hashes"| node_hash
node_shared_store -->|"generates reminders"| node_reminder_engine
node_reminder_engine -->|"returns reminders"| node_shared_store
node_public_verify -->|"reads records"| node_shared_store
node_patient_actor -.->|"finds facilities"| node_nearby
node_patient_actor -.->|"seeks emergency guidance"| node_emergency
node_patient_actor -.->|"reviews hospitals"| node_reviews

click node_app "https://github.com/harshtyagi334/vactrack/blob/main/src/App.tsx"
click node_auth "https://github.com/harshtyagi334/vactrack/blob/main/src/pages/AuthPages.tsx"
click node_patient_routes "https://github.com/harshtyagi334/vactrack/blob/main/src/pages/PatientPages.tsx"
click node_patient_dashboard "https://github.com/harshtyagi334/vactrack/blob/main/src/pages/PatientDashboard.tsx"
click node_health_record "https://github.com/harshtyagi334/vactrack/blob/main/src/pages/PatientHealthRecord.tsx"
click node_schedule "https://github.com/harshtyagi334/vactrack/blob/main/src/components/RabiesPEPInteractiveSchedule.tsx"
click node_notifications "https://github.com/harshtyagi334/vactrack/blob/main/src/components/PatientNotificationCenter.tsx"
click node_nearby "https://github.com/harshtyagi334/vactrack/blob/main/src/pages/PatientNearbyHospitals.tsx"
click node_emergency "https://github.com/harshtyagi334/vactrack/blob/main/src/pages/PatientEmergencyCare.tsx"
click node_export "https://github.com/harshtyagi334/vactrack/blob/main/src/components/ExportVaccinationReportModal.tsx"
click node_clinic_routes "https://github.com/harshtyagi334/vactrack/blob/main/src/pages/ClinicPages.tsx"
click node_clinic_dashboard "https://github.com/harshtyagi334/vactrack/blob/main/src/pages/ClinicDashboard.tsx"
click node_patient_search "https://github.com/harshtyagi334/vactrack/blob/main/src/components/PatientVaccinationSearchBar.tsx"
click node_patient_record "https://github.com/harshtyagi334/vactrack/blob/main/src/pages/Clinic/PatientRecord.tsx"
click node_inventory "https://github.com/harshtyagi334/vactrack/blob/main/src/components/HospitalOperations/VaccineInventoryTable.tsx"
click node_doctors "https://github.com/harshtyagi334/vactrack/blob/main/src/components/HospitalOperations/DoctorAvailability.tsx"
click node_ambulance "https://github.com/harshtyagi334/vactrack/blob/main/src/components/HospitalOperations/AmbulanceMonitoring.tsx"
click node_reviews "https://github.com/harshtyagi334/vactrack/blob/main/src/components/HospitalOperations/HospitalReviewsSection.tsx"
click node_schemes "https://github.com/harshtyagi334/vactrack/blob/main/src/components/GovernmentSchemes/GovernmentSchemesDiscovery.tsx"
click node_eligibility "https://github.com/harshtyagi334/vactrack/blob/main/src/components/GovernmentSchemes/SchemeEligibilityWizard.tsx"
click node_scheme_detail "https://github.com/harshtyagi334/vactrack/blob/main/src/components/GovernmentSchemes/SchemeDetailModal.tsx"
click node_scheme_hospitals "https://github.com/harshtyagi334/vactrack/blob/main/src/components/GovernmentSchemes/EmpanelledHospitalsModal.tsx"
click node_scheme_data "https://github.com/harshtyagi334/vactrack/blob/main/src/data/governmentSchemesData.ts"
click node_medicine_verify "https://github.com/harshtyagi334/vactrack/blob/main/src/pages/MedicineVerificationPage.tsx"
click node_shared_store "https://github.com/harshtyagi334/vactrack/blob/main/src/store/index.ts"
click node_hash "https://github.com/harshtyagi334/vactrack/blob/main/src/utils/hash.ts"
click node_reminder_engine "https://github.com/harshtyagi334/vactrack/blob/main/src/utils/reminderEngine.ts"
click node_public_verify "https://github.com/harshtyagi334/vactrack/blob/main/src/pages/PatientPublicVerifyPage.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,node_auth toneBlue
class node_patient_routes,node_patient_dashboard,node_health_record,node_schedule,node_notifications,node_nearby,node_emergency,node_export toneAmber
class node_clinic_routes,node_clinic_dashboard,node_patient_search,node_patient_record,node_inventory,node_doctors,node_ambulance,node_reviews toneMint
class node_schemes,node_eligibility,node_scheme_detail,node_scheme_hospitals,node_scheme_data,node_medicine_verify toneRose
class node_shared_store,node_hash,node_reminder_engine,node_public_verify,node_patient_actor,node_clinic_actor toneIndigo
```

## Components

### App entry and access

- [Route application](https://github.com/harshtyagi334/vactrack/blob/main/src/App.tsx): `src/App.tsx`
- [Authentication](https://github.com/harshtyagi334/vactrack/blob/main/src/pages/AuthPages.tsx): `src/pages/AuthPages.tsx`

### Patient care

- [Patient portal routes](https://github.com/harshtyagi334/vactrack/blob/main/src/pages/PatientPages.tsx): `src/pages/PatientPages.tsx`
- [Patient dashboard](https://github.com/harshtyagi334/vactrack/blob/main/src/pages/PatientDashboard.tsx): `src/pages/PatientDashboard.tsx`
- [Health record](https://github.com/harshtyagi334/vactrack/blob/main/src/pages/PatientHealthRecord.tsx): `src/pages/PatientHealthRecord.tsx`
- [Rabies PEP schedule](https://github.com/harshtyagi334/vactrack/blob/main/src/components/RabiesPEPInteractiveSchedule.tsx): `src/components/RabiesPEPInteractiveSchedule.tsx`
- [Reminders and alerts](https://github.com/harshtyagi334/vactrack/blob/main/src/components/PatientNotificationCenter.tsx): `src/components/PatientNotificationCenter.tsx`
- [Nearby hospitals](https://github.com/harshtyagi334/vactrack/blob/main/src/pages/PatientNearbyHospitals.tsx): `src/pages/PatientNearbyHospitals.tsx`
- [Emergency care](https://github.com/harshtyagi334/vactrack/blob/main/src/pages/PatientEmergencyCare.tsx): `src/pages/PatientEmergencyCare.tsx`
- [Vaccination report export](https://github.com/harshtyagi334/vactrack/blob/main/src/components/ExportVaccinationReportModal.tsx): `src/components/ExportVaccinationReportModal.tsx`

### Clinic operations

- [Clinic portal routes](https://github.com/harshtyagi334/vactrack/blob/main/src/pages/ClinicPages.tsx): `src/pages/ClinicPages.tsx`
- [Clinic dashboard](https://github.com/harshtyagi334/vactrack/blob/main/src/pages/ClinicDashboard.tsx): `src/pages/ClinicDashboard.tsx`
- [Cross-clinic patient search](https://github.com/harshtyagi334/vactrack/blob/main/src/components/PatientVaccinationSearchBar.tsx): `src/components/PatientVaccinationSearchBar.tsx`
- [Clinic patient record](https://github.com/harshtyagi334/vactrack/blob/main/src/pages/Clinic/PatientRecord.tsx): `src/pages/Clinic/PatientRecord.tsx`
- [Vaccine inventory](https://github.com/harshtyagi334/vactrack/blob/main/src/components/HospitalOperations/VaccineInventoryTable.tsx): `src/components/HospitalOperations/VaccineInventoryTable.tsx`
- [Doctor availability](https://github.com/harshtyagi334/vactrack/blob/main/src/components/HospitalOperations/DoctorAvailability.tsx): `src/components/HospitalOperations/DoctorAvailability.tsx`
- [Ambulance monitoring](https://github.com/harshtyagi334/vactrack/blob/main/src/components/HospitalOperations/AmbulanceMonitoring.tsx): `src/components/HospitalOperations/AmbulanceMonitoring.tsx`
- [Hospital reviews](https://github.com/harshtyagi334/vactrack/blob/main/src/components/HospitalOperations/HospitalReviewsSection.tsx): `src/components/HospitalOperations/HospitalReviewsSection.tsx`

### Benefits and verification

- [Scheme discovery](https://github.com/harshtyagi334/vactrack/blob/main/src/components/GovernmentSchemes/GovernmentSchemesDiscovery.tsx): `src/components/GovernmentSchemes/GovernmentSchemesDiscovery.tsx`
- [Eligibility guidance](https://github.com/harshtyagi334/vactrack/blob/main/src/components/GovernmentSchemes/SchemeEligibilityWizard.tsx): `src/components/GovernmentSchemes/SchemeEligibilityWizard.tsx`
- [Scheme details](https://github.com/harshtyagi334/vactrack/blob/main/src/components/GovernmentSchemes/SchemeDetailModal.tsx): `src/components/GovernmentSchemes/SchemeDetailModal.tsx`
- [Empanelled hospitals](https://github.com/harshtyagi334/vactrack/blob/main/src/components/GovernmentSchemes/EmpanelledHospitalsModal.tsx): `src/components/GovernmentSchemes/EmpanelledHospitalsModal.tsx`
- [Scheme reference data](https://github.com/harshtyagi334/vactrack/blob/main/src/data/governmentSchemesData.ts): `src/data/governmentSchemesData.ts`
- [Medicine and batch verification](https://github.com/harshtyagi334/vactrack/blob/main/src/pages/MedicineVerificationPage.tsx): `src/pages/MedicineVerificationPage.tsx`

### Shared application core

- [Persisted application state](https://github.com/harshtyagi334/vactrack/blob/main/src/store/index.ts): `src/store/index.ts`
- [Hash-chain integrity](https://github.com/harshtyagi334/vactrack/blob/main/src/utils/hash.ts): `src/utils/hash.ts`
- [Reminder calculation](https://github.com/harshtyagi334/vactrack/blob/main/src/utils/reminderEngine.ts): `src/utils/reminderEngine.ts`
- [Public record verification](https://github.com/harshtyagi334/vactrack/blob/main/src/pages/PatientPublicVerifyPage.tsx): `src/pages/PatientPublicVerifyPage.tsx`

### Other components

- **Patient**
- **Clinic staff**

## Connections

- Patient → Authentication: registers or logs in
- Clinic staff → Authentication: registers or logs in
- Route application → Authentication: routes to (evidence: `src/App.tsx`)
- Route application → Patient portal routes: protects patient routes (evidence: `src/App.tsx`)
- Route application → Clinic portal routes: protects clinic routes (evidence: `src/App.tsx`)
- Route application → Public record verification: routes to (evidence: `src/App.tsx`)
- Patient portal routes → Patient dashboard: renders (evidence: `src/pages/PatientPages.tsx`)
- Patient portal routes → Health record: renders (evidence: `src/pages/PatientPages.tsx`)
- Patient portal routes → Rabies PEP schedule: renders (evidence: `src/pages/PatientPages.tsx`)
- Patient portal routes → Reminders and alerts: renders (evidence: `src/pages/PatientPages.tsx`)
- Patient portal routes → Nearby hospitals: renders (evidence: `src/pages/PatientPages.tsx`)
- Patient portal routes → Emergency care: renders (evidence: `src/pages/PatientPages.tsx`)
- Patient portal routes → Vaccination report export: renders (evidence: `src/pages/PatientPages.tsx`)
- Patient portal routes → Persisted application state: reads and updates (evidence: `src/pages/PatientPages.tsx`)
- Clinic portal routes → Clinic dashboard: renders (evidence: `src/pages/ClinicPages.tsx`)
- Clinic portal routes → Clinic patient record: renders (evidence: `src/pages/ClinicPages.tsx`)
- Clinic portal routes → Persisted application state: reads and updates (evidence: `src/pages/ClinicPages.tsx`)
- Clinic staff → Cross-clinic patient search: searches patients (evidence: `README.md`)
- Clinic staff → Vaccine inventory: manages stock (evidence: `README.md`)
- Clinic staff → Doctor availability: updates availability (evidence: `README.md`)
- Clinic staff → Ambulance monitoring: monitors status (evidence: `README.md`)
- Clinic patient record → Persisted application state: reads and updates (evidence: `src/pages/Clinic/PatientRecord.tsx`)
- Vaccine inventory → Persisted application state: reads and updates (evidence: `src/components/HospitalOperations/VaccineInventoryTable.tsx`)
- Ambulance monitoring → Persisted application state: reads and updates (evidence: `src/components/HospitalOperations/AmbulanceMonitoring.tsx`)
- Hospital reviews → Persisted application state: reads and updates (evidence: `src/components/HospitalOperations/HospitalReviewsSection.tsx`)
- Patient → Patient portal routes: uses portal (evidence: `README.md`)
- Patient → Scheme discovery: discovers benefits
- Patient portal routes → Scheme discovery: renders (evidence: `src/pages/PatientPages.tsx`)
- Scheme discovery → Eligibility guidance: opens guidance (evidence: `src/components/GovernmentSchemes/GovernmentSchemesDiscovery.tsx`)
- Scheme discovery → Scheme details: opens details (evidence: `src/components/GovernmentSchemes/GovernmentSchemesDiscovery.tsx`)
- Scheme discovery → Empanelled hospitals: opens hospitals (evidence: `src/components/GovernmentSchemes/GovernmentSchemesDiscovery.tsx`)
- Scheme discovery → Scheme reference data: filters and displays (evidence: `src/components/GovernmentSchemes/GovernmentSchemesDiscovery.tsx`)
- Eligibility guidance → Scheme reference data: uses scheme data (evidence: `src/components/GovernmentSchemes/SchemeEligibilityWizard.tsx`)
- Scheme details → Scheme reference data: displays scheme data (evidence: `src/components/GovernmentSchemes/SchemeDetailModal.tsx`)
- Empanelled hospitals → Scheme reference data: reads network data (evidence: `src/components/GovernmentSchemes/EmpanelledHospitalsModal.tsx`)
- Patient → Medicine and batch verification: checks vaccine batch (evidence: `README.md`)
- Patient portal routes → Medicine and batch verification: renders (evidence: `src/pages/PatientPages.tsx`)
- Authentication → Persisted application state: authenticates account (evidence: `src/App.tsx`)
- Persisted application state → Hash-chain integrity: creates and checks hashes (evidence: `src/store/index.ts`)
- Persisted application state → Reminder calculation: generates reminders (evidence: `src/store/index.ts`)
- Reminder calculation → Persisted application state: returns reminders (evidence: `src/store/index.ts`)
- Public record verification → Persisted application state: reads records (evidence: `src/pages/PatientPublicVerifyPage.tsx`)
- Patient → Nearby hospitals: finds facilities (evidence: `README.md`)
- Patient → Emergency care: seeks emergency guidance (evidence: `README.md`)
- Patient → Hospital reviews: reviews hospitals (evidence: `README.md`)
