# vaibhav-1786/clinicconnect architecture

> Architecture diagram of the GitHub repository vaibhav-1786/clinicconnect, 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/vaibhav-1786/clinicconnect
- Repository: https://github.com/vaibhav-1786/clinicconnect

## Overview

ClinicConnect is a role-based clinic and hospital management platform. Its main patient-to-care workflow is clinic discovery and appointment booking, receptionist review and queue handling, doctor consultation and prescription, then billing and patient follow-up. Separate branches support administration, patient records and safety features, and platform services such as authentication, localization and offline awareness. Backend routes are registered by the Flask app; sampled route references show database and service dependencies. Many feature modules were not sampled, so their internal links are shown only where documented.

Main entry points: [`frontend/src/services/api.js`](https://github.com/vaibhav-1786/clinicconnect/blob/main/frontend/src/services/api.js) (API client), [`frontend/src/App.jsx`](https://github.com/vaibhav-1786/clinicconnect/blob/main/frontend/src/App.jsx) (Role-based app), [`frontend/src/pages/patient`](https://github.com/vaibhav-1786/clinicconnect/tree/main/frontend/src/pages/patient) (Patient portal), [`frontend/src/pages/receptionist`](https://github.com/vaibhav-1786/clinicconnect/tree/main/frontend/src/pages/receptionist) (Receptionist portal)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Portals and experience"]
  node_app["Role-based app<br/>[App.jsx]"]
  node_patient["Patient portal"]
  node_receptionist["Receptionist portal"]
  node_doctor["Doctor portal"]
  node_adminui["Admin portal"]
  node_layout["Shared dashboard"]
end

subgraph group_care["Care workflow"]
  node_discovery["Clinic discovery<br/>[clinics.py]"]
  node_appointments["Appointments and slots<br/>[appointments.py]"]
  node_carefeatures["Patient care records"]
  node_clinical["Consultation and prescriptions<br/>[clinical.py]"]
end

subgraph group_operations["Clinic operations"]
  node_billing["Billing and insurance<br/>[billing.py]"]
  node_queue["Queue and waitlist<br/>[waitlist.py]"]
end

subgraph group_admin["Administration"]
  node_adminfeatures["Admin and analytics<br/>[admin.py]"]
  node_adminservices["Admin analytics and alerts<br/>[admin_analytics.py]"]
  node_matching["Matching and forecasting<br/>[matching.py]"]
end

subgraph group_platform["Platform services"]
  node_api["API client<br/>[api.js]"]
  node_authui["Session context<br/>[AuthContext.jsx]"]
  node_language["Language context"]
  node_translations["Translations<br/>[translations.js]"]
  node_appserver["Flask app<br/>[__init__.py]"]
  node_auth["Authentication<br/>[auth.py]"]
  node_authguard["JWT and role checks<br/>[auth.py]"]
  node_routes["Feature API routes"]
  node_dbutil["Database access<br/>[db.py]"]
  node_database[("MySQL database")]
  node_mailer["Email delivery<br/>[mailer.py]"]
  node_google["Google Sign-In<br/>[google_auth.py]"]
end

node_user(("Portal user"))

node_user -->|"uses"| node_app
node_app -->|"routes to"| node_patient
node_app -->|"routes to"| node_receptionist
node_app -->|"routes to"| node_doctor
node_app -->|"routes to"| node_adminui
node_patient -.->|"requests through"| node_api
node_receptionist -->|"requests through"| node_api
node_doctor -->|"requests through"| node_api
node_adminui -->|"requests through"| node_api
node_app -->|"provides session"| node_authui
node_layout -->|"requests through"| node_api
node_layout -->|"uses"| node_language
node_language -->|"looks up"| node_translations
node_authui -->|"calls"| node_api
node_api -.->|"sends API requests"| node_appserver
node_appserver -->|"registers"| node_auth
node_appserver -->|"registers"| node_routes
node_auth -->|"requires authentication"| node_authguard
node_authguard -->|"checks token validity"| node_dbutil
node_dbutil -->|"queries"| node_database
node_appointments -->|"uses waitlist"| node_queue
node_appointments -->|"uses checklist"| node_carefeatures
node_adminfeatures -->|"uses matching services"| node_matching
node_adminfeatures -.->|"supports analytics and alerts"| node_adminservices
node_patient -.->|"finds clinics"| node_discovery
node_patient -.->|"books appointments"| node_appointments
node_receptionist -.->|"reviews requests"| node_appointments
node_receptionist -.->|"manages queue"| node_queue
node_doctor -.->|"records consultation"| node_clinical
node_receptionist -->|"creates invoices"| node_billing
node_patient -->|"pays and views receipts"| node_billing
node_patient -.->|"uses care features"| node_carefeatures
node_adminui -.->|"manages clinic system"| node_adminfeatures
node_auth -->|"supports sign-in"| node_google
node_auth -->|"uses email service"| node_mailer

click node_app "https://github.com/vaibhav-1786/clinicconnect/blob/main/frontend/src/App.jsx"
click node_patient "https://github.com/vaibhav-1786/clinicconnect/tree/main/frontend/src/pages/patient"
click node_receptionist "https://github.com/vaibhav-1786/clinicconnect/tree/main/frontend/src/pages/receptionist"
click node_doctor "https://github.com/vaibhav-1786/clinicconnect/tree/main/frontend/src/pages/doctor"
click node_adminui "https://github.com/vaibhav-1786/clinicconnect/tree/main/frontend/src/pages/admin"
click node_layout "https://github.com/vaibhav-1786/clinicconnect/blob/main/frontend/src/layouts/DashboardLayout.jsx"
click node_api "https://github.com/vaibhav-1786/clinicconnect/blob/main/frontend/src/services/api.js"
click node_authui "https://github.com/vaibhav-1786/clinicconnect/blob/main/frontend/src/context/AuthContext.jsx"
click node_language "https://github.com/vaibhav-1786/clinicconnect/blob/main/frontend/src/context/LanguageContext.jsx"
click node_translations "https://github.com/vaibhav-1786/clinicconnect/blob/main/frontend/src/i18n/translations.js"
click node_appserver "https://github.com/vaibhav-1786/clinicconnect/blob/main/backend/app/__init__.py"
click node_auth "https://github.com/vaibhav-1786/clinicconnect/blob/main/backend/app/routes/auth.py"
click node_authguard "https://github.com/vaibhav-1786/clinicconnect/blob/main/backend/app/utils/auth.py"
click node_routes "https://github.com/vaibhav-1786/clinicconnect/tree/main/backend/app/routes"
click node_dbutil "https://github.com/vaibhav-1786/clinicconnect/blob/main/backend/app/utils/db.py"
click node_discovery "https://github.com/vaibhav-1786/clinicconnect/blob/main/backend/app/routes/clinics.py"
click node_appointments "https://github.com/vaibhav-1786/clinicconnect/blob/main/backend/app/routes/appointments.py"
click node_carefeatures "https://github.com/vaibhav-1786/clinicconnect/tree/main/backend/app/routes"
click node_clinical "https://github.com/vaibhav-1786/clinicconnect/blob/main/backend/app/routes/clinical.py"
click node_billing "https://github.com/vaibhav-1786/clinicconnect/blob/main/backend/app/routes/billing.py"
click node_queue "https://github.com/vaibhav-1786/clinicconnect/blob/main/backend/app/routes/waitlist.py"
click node_adminfeatures "https://github.com/vaibhav-1786/clinicconnect/blob/main/backend/app/routes/admin.py"
click node_adminservices "https://github.com/vaibhav-1786/clinicconnect/blob/main/backend/app/routes/admin_analytics.py"
click node_matching "https://github.com/vaibhav-1786/clinicconnect/blob/main/backend/app/services/matching.py"
click node_mailer "https://github.com/vaibhav-1786/clinicconnect/blob/main/backend/app/services/mailer.py"
click node_google "https://github.com/vaibhav-1786/clinicconnect/blob/main/backend/app/services/google_auth.py"

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_patient,node_receptionist,node_doctor,node_adminui,node_layout,node_user toneBlue
class node_discovery,node_appointments,node_carefeatures,node_clinical toneAmber
class node_billing,node_queue toneMint
class node_adminfeatures,node_adminservices,node_matching toneRose
class node_api,node_authui,node_language,node_translations,node_appserver,node_auth,node_authguard,node_routes,node_dbutil,node_database,node_mailer,node_google toneIndigo
```

## Components

### Portals and experience

- [Role-based app](https://github.com/vaibhav-1786/clinicconnect/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Patient portal](https://github.com/vaibhav-1786/clinicconnect/tree/main/frontend/src/pages/patient): `frontend/src/pages/patient`
- [Receptionist portal](https://github.com/vaibhav-1786/clinicconnect/tree/main/frontend/src/pages/receptionist): `frontend/src/pages/receptionist`
- [Doctor portal](https://github.com/vaibhav-1786/clinicconnect/tree/main/frontend/src/pages/doctor): `frontend/src/pages/doctor`
- [Admin portal](https://github.com/vaibhav-1786/clinicconnect/tree/main/frontend/src/pages/admin): `frontend/src/pages/admin`
- [Shared dashboard](https://github.com/vaibhav-1786/clinicconnect/blob/main/frontend/src/layouts/DashboardLayout.jsx): `frontend/src/layouts/DashboardLayout.jsx`

### Care workflow

- [Clinic discovery](https://github.com/vaibhav-1786/clinicconnect/blob/main/backend/app/routes/clinics.py): `backend/app/routes/clinics.py`
- [Appointments and slots](https://github.com/vaibhav-1786/clinicconnect/blob/main/backend/app/routes/appointments.py): `backend/app/routes/appointments.py`
- [Patient care records](https://github.com/vaibhav-1786/clinicconnect/tree/main/backend/app/routes): `backend/app/routes`
- [Consultation and prescriptions](https://github.com/vaibhav-1786/clinicconnect/blob/main/backend/app/routes/clinical.py): `backend/app/routes/clinical.py`

### Clinic operations

- [Billing and insurance](https://github.com/vaibhav-1786/clinicconnect/blob/main/backend/app/routes/billing.py): `backend/app/routes/billing.py`
- [Queue and waitlist](https://github.com/vaibhav-1786/clinicconnect/blob/main/backend/app/routes/waitlist.py): `backend/app/routes/waitlist.py`

### Administration

- [Admin and analytics](https://github.com/vaibhav-1786/clinicconnect/blob/main/backend/app/routes/admin.py): `backend/app/routes/admin.py`
- [Admin analytics and alerts](https://github.com/vaibhav-1786/clinicconnect/blob/main/backend/app/routes/admin_analytics.py): `backend/app/routes/admin_analytics.py`
- [Matching and forecasting](https://github.com/vaibhav-1786/clinicconnect/blob/main/backend/app/services/matching.py): `backend/app/services/matching.py`

### Platform services

- [API client](https://github.com/vaibhav-1786/clinicconnect/blob/main/frontend/src/services/api.js): `frontend/src/services/api.js`
- [Session context](https://github.com/vaibhav-1786/clinicconnect/blob/main/frontend/src/context/AuthContext.jsx): `frontend/src/context/AuthContext.jsx`
- [Language context](https://github.com/vaibhav-1786/clinicconnect/blob/main/frontend/src/context/LanguageContext.jsx): `frontend/src/context/LanguageContext.jsx`
- [Translations](https://github.com/vaibhav-1786/clinicconnect/blob/main/frontend/src/i18n/translations.js): `frontend/src/i18n/translations.js`
- [Flask app](https://github.com/vaibhav-1786/clinicconnect/blob/main/backend/app/__init__.py): `backend/app/__init__.py`
- [Authentication](https://github.com/vaibhav-1786/clinicconnect/blob/main/backend/app/routes/auth.py): `backend/app/routes/auth.py`
- [JWT and role checks](https://github.com/vaibhav-1786/clinicconnect/blob/main/backend/app/utils/auth.py): `backend/app/utils/auth.py`
- [Feature API routes](https://github.com/vaibhav-1786/clinicconnect/tree/main/backend/app/routes): `backend/app/routes`
- [Database access](https://github.com/vaibhav-1786/clinicconnect/blob/main/backend/app/utils/db.py): `backend/app/utils/db.py`
- **MySQL database**
- [Email delivery](https://github.com/vaibhav-1786/clinicconnect/blob/main/backend/app/services/mailer.py): `backend/app/services/mailer.py`
- [Google Sign-In](https://github.com/vaibhav-1786/clinicconnect/blob/main/backend/app/services/google_auth.py): `backend/app/services/google_auth.py`

### Other components

- **Portal user**

## Connections

- Portal user → Role-based app: uses (evidence: `frontend/src/App.jsx`)
- Role-based app → Patient portal: routes to (evidence: `frontend/src/App.jsx`)
- Role-based app → Receptionist portal: routes to (evidence: `frontend/src/App.jsx`)
- Role-based app → Doctor portal: routes to (evidence: `frontend/src/App.jsx`)
- Role-based app → Admin portal: routes to (evidence: `frontend/src/App.jsx`)
- Patient portal → API client: requests through (evidence: `frontend/src/pages/patient/FindClinics.jsx`)
- Receptionist portal → API client: requests through (evidence: `frontend/src/pages/receptionist/Billing.jsx`)
- Doctor portal → API client: requests through (evidence: `frontend/src/pages/doctor/Appointments.jsx`)
- Admin portal → API client: requests through (evidence: `frontend/src/pages/admin/Applications.jsx`)
- Role-based app → Session context: provides session (evidence: `frontend/src/App.jsx`)
- Shared dashboard → API client: requests through (evidence: `frontend/src/layouts/DashboardLayout.jsx`)
- Shared dashboard → Language context: uses (evidence: `frontend/src/layouts/DashboardLayout.jsx`)
- Language context → Translations: looks up (evidence: `frontend/src/context/LanguageContext.jsx`)
- Session context → API client: calls (evidence: `frontend/src/context/AuthContext.jsx`)
- API client → Flask app: sends API requests
- Flask app → Authentication: registers (evidence: `backend/app/__init__.py`)
- Flask app → Feature API routes: registers (evidence: `backend/app/__init__.py`)
- Authentication → JWT and role checks: requires authentication (evidence: `backend/app/routes/auth.py`)
- JWT and role checks → Database access: checks token validity (evidence: `backend/app/utils/auth.py`)
- Database access → MySQL database: queries (evidence: `backend/app/utils/db.py`)
- Appointments and slots → Queue and waitlist: uses waitlist (evidence: `backend/app/routes/appointments.py`)
- Appointments and slots → Patient care records: uses checklist (evidence: `backend/app/routes/appointments.py`)
- Admin and analytics → Matching and forecasting: uses matching services (evidence: `backend/app/routes/admin.py`)
- Admin and analytics → Admin analytics and alerts: supports analytics and alerts
- Patient portal → Clinic discovery: finds clinics
- Patient portal → Appointments and slots: books appointments
- Receptionist portal → Appointments and slots: reviews requests
- Receptionist portal → Queue and waitlist: manages queue
- Doctor portal → Consultation and prescriptions: records consultation
- Receptionist portal → Billing and insurance: creates invoices
- Patient portal → Billing and insurance: pays and views receipts
- Patient portal → Patient care records: uses care features
- Admin portal → Admin and analytics: manages clinic system
- Authentication → Google Sign-In: supports sign-in (evidence: `backend/app/routes/auth.py`)
- Authentication → Email delivery: uses email service (evidence: `backend/app/routes/auth.py`)
