# lohithpesala-08-05/health-hub-project architecture

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

- Interactive diagram: https://gitdiagram.com/lohithpesala-08-05/health-hub-project
- Repository: https://github.com/lohithpesala-08-05/health-hub-project

## Overview

Health Hub combines a React wellness portal with an Express API. Users register or log in, then access BMI, hydration, sleep, habit tracking, and guidance; they can book appointments or send contact messages, while doctors can view bookings. The API routes these requests to authentication, appointment, and contact controllers, which use MongoDB models or the local JSON-backed store. The README also lists legacy server-rendered pages. The sampled excerpts support the main client/API and persistence links; unsampled model details and legacy rendering are represented conservatively.

Main entry points: [`client/src/App.jsx`](https://github.com/lohithpesala-08-05/health-hub-project/blob/main/client/src/App.jsx) (React app), [`server/src/controllers/authController.js`](https://github.com/lohithpesala-08-05/health-hub-project/blob/main/server/src/controllers/authController.js) (Authentication), [`server/src/routes/apiRoutes.js`](https://github.com/lohithpesala-08-05/health-hub-project/blob/main/server/src/routes/apiRoutes.js) (API routes), [`server/src/services/dataStore.js`](https://github.com/lohithpesala-08-05/health-hub-project/blob/main/server/src/services/dataStore.js) (Local JSON store)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Wellness portal"]
  node_react["React app<br/>[App.jsx]"]
  node_api_client["API client<br/>[api.js]"]
  node_wellness_tools["Wellness tools<br/>[App.jsx]"]
  node_wellness_guidance["Wellness guidance<br/>[App.jsx]"]
  node_auth_ui["Account forms<br/>[App.jsx]"]
  node_appointments_ui["Doctor bookings view<br/>[App.jsx]"]
end

subgraph group_api["API and access"]
  node_express_app["Express app<br/>[app.js]"]
  node_api_routes["API routes<br/>[apiRoutes.js]"]
  node_legacy_routes["Legacy web routes<br/>[webRoutes.js]"]
  node_page_rendering["Legacy page rendering<br/>[pageController.js]"]
  node_view_registry["View registry<br/>[viewRegistry.js]"]
end

subgraph group_domain["Health services"]
  node_auth["Authentication<br/>[authController.js]"]
  node_appointments["Appointment handling"]
  node_contacts["Contact handling"]
  node_hash["Password hashing<br/>[hash.js]"]
end

subgraph group_persistence["Persistence"]
  node_appointment_model[("Appointment records<br/>[Appointment.js]")]
  node_user_model[("User records<br/>[User.js]")]
  node_doctor_model[("Doctor records<br/>[Doctor.js]")]
  node_contact_model[("Contact records<br/>[Contact.js]")]
  node_store[("Local JSON store<br/>[dataStore.js]")]
  node_database_config["MongoDB connection<br/>[database.js]"]
end

node_visitor(("Visitor"))
node_doctor(("Doctor"))

node_visitor -->|"uses"| node_react
node_doctor -->|"views bookings"| node_react
node_react -->|"calls"| node_api_client
node_react -->|"renders"| node_wellness_tools
node_react -->|"renders"| node_wellness_guidance
node_react -->|"renders"| node_auth_ui
node_react -->|"renders"| node_appointments_ui
node_api_client -->|"requests API"| node_express_app
node_express_app -->|"mounts"| node_api_routes
node_api_routes -->|"routes auth"| node_auth
node_api_routes -->|"routes bookings"| node_appointments
node_api_routes -->|"routes messages"| node_contacts
node_auth -->|"reads/writes"| node_store
node_auth -->|"queries"| node_user_model
node_auth -->|"queries"| node_doctor_model
node_auth -->|"verifies passwords"| node_hash
node_appointments -->|"reads/writes"| node_store
node_appointments -->|"queries"| node_appointment_model
node_contacts -->|"writes"| node_store
node_contacts -->|"creates records"| node_contact_model
node_express_app -->|"connects"| node_database_config
node_database_config -->|"sets connection state"| node_store
node_legacy_routes -->|"routes pages"| node_page_rendering
node_page_rendering -->|"looks up views"| node_view_registry

click node_react "https://github.com/lohithpesala-08-05/health-hub-project/blob/main/client/src/App.jsx"
click node_api_client "https://github.com/lohithpesala-08-05/health-hub-project/blob/main/client/src/api.js"
click node_wellness_tools "https://github.com/lohithpesala-08-05/health-hub-project/blob/main/client/src/App.jsx"
click node_wellness_guidance "https://github.com/lohithpesala-08-05/health-hub-project/blob/main/client/src/App.jsx"
click node_auth_ui "https://github.com/lohithpesala-08-05/health-hub-project/blob/main/client/src/App.jsx"
click node_appointments_ui "https://github.com/lohithpesala-08-05/health-hub-project/blob/main/client/src/App.jsx"
click node_express_app "https://github.com/lohithpesala-08-05/health-hub-project/blob/main/server/src/app.js"
click node_api_routes "https://github.com/lohithpesala-08-05/health-hub-project/blob/main/server/src/routes/apiRoutes.js"
click node_auth "https://github.com/lohithpesala-08-05/health-hub-project/blob/main/server/src/controllers/authController.js"
click node_appointments "https://github.com/lohithpesala-08-05/health-hub-project/blob/main/server/src/controllers/appointmentController.js"
click node_contacts "https://github.com/lohithpesala-08-05/health-hub-project/blob/main/server/src/controllers/contactController.js"
click node_appointment_model "https://github.com/lohithpesala-08-05/health-hub-project/blob/main/server/src/models/Appointment.js"
click node_user_model "https://github.com/lohithpesala-08-05/health-hub-project/blob/main/server/src/models/User.js"
click node_doctor_model "https://github.com/lohithpesala-08-05/health-hub-project/blob/main/server/src/models/Doctor.js"
click node_contact_model "https://github.com/lohithpesala-08-05/health-hub-project/blob/main/server/src/models/Contact.js"
click node_store "https://github.com/lohithpesala-08-05/health-hub-project/blob/main/server/src/services/dataStore.js"
click node_database_config "https://github.com/lohithpesala-08-05/health-hub-project/blob/main/server/src/config/database.js"
click node_hash "https://github.com/lohithpesala-08-05/health-hub-project/blob/main/server/src/utils/hash.js"
click node_legacy_routes "https://github.com/lohithpesala-08-05/health-hub-project/blob/main/server/src/routes/webRoutes.js"
click node_page_rendering "https://github.com/lohithpesala-08-05/health-hub-project/blob/main/server/src/controllers/pageController.js"
click node_view_registry "https://github.com/lohithpesala-08-05/health-hub-project/blob/main/server/src/config/viewRegistry.js"

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_react,node_api_client,node_wellness_tools,node_wellness_guidance,node_auth_ui,node_appointments_ui toneBlue
class node_express_app,node_api_routes,node_legacy_routes,node_page_rendering,node_view_registry toneAmber
class node_auth,node_appointments,node_contacts,node_hash toneMint
class node_appointment_model,node_user_model,node_doctor_model,node_contact_model,node_store,node_database_config toneRose
class node_visitor,node_doctor toneIndigo
```

## Components

### Wellness portal

- [React app](https://github.com/lohithpesala-08-05/health-hub-project/blob/main/client/src/App.jsx): `client/src/App.jsx`
- [API client](https://github.com/lohithpesala-08-05/health-hub-project/blob/main/client/src/api.js): `client/src/api.js`
- [Wellness tools](https://github.com/lohithpesala-08-05/health-hub-project/blob/main/client/src/App.jsx): `client/src/App.jsx`
- [Wellness guidance](https://github.com/lohithpesala-08-05/health-hub-project/blob/main/client/src/App.jsx): `client/src/App.jsx`
- [Account forms](https://github.com/lohithpesala-08-05/health-hub-project/blob/main/client/src/App.jsx): `client/src/App.jsx`
- [Doctor bookings view](https://github.com/lohithpesala-08-05/health-hub-project/blob/main/client/src/App.jsx): `client/src/App.jsx`

### API and access

- [Express app](https://github.com/lohithpesala-08-05/health-hub-project/blob/main/server/src/app.js): `server/src/app.js`
- [API routes](https://github.com/lohithpesala-08-05/health-hub-project/blob/main/server/src/routes/apiRoutes.js): `server/src/routes/apiRoutes.js`
- [Legacy web routes](https://github.com/lohithpesala-08-05/health-hub-project/blob/main/server/src/routes/webRoutes.js): `server/src/routes/webRoutes.js`
- [Legacy page rendering](https://github.com/lohithpesala-08-05/health-hub-project/blob/main/server/src/controllers/pageController.js): `server/src/controllers/pageController.js`
- [View registry](https://github.com/lohithpesala-08-05/health-hub-project/blob/main/server/src/config/viewRegistry.js): `server/src/config/viewRegistry.js`

### Health services

- [Authentication](https://github.com/lohithpesala-08-05/health-hub-project/blob/main/server/src/controllers/authController.js): `server/src/controllers/authController.js`
- [Appointment handling](https://github.com/lohithpesala-08-05/health-hub-project/blob/main/server/src/controllers/appointmentController.js): `server/src/controllers/appointmentController.js`
- [Contact handling](https://github.com/lohithpesala-08-05/health-hub-project/blob/main/server/src/controllers/contactController.js): `server/src/controllers/contactController.js`
- [Password hashing](https://github.com/lohithpesala-08-05/health-hub-project/blob/main/server/src/utils/hash.js): `server/src/utils/hash.js`

### Persistence

- [Appointment records](https://github.com/lohithpesala-08-05/health-hub-project/blob/main/server/src/models/Appointment.js): `server/src/models/Appointment.js`
- [User records](https://github.com/lohithpesala-08-05/health-hub-project/blob/main/server/src/models/User.js): `server/src/models/User.js`
- [Doctor records](https://github.com/lohithpesala-08-05/health-hub-project/blob/main/server/src/models/Doctor.js): `server/src/models/Doctor.js`
- [Contact records](https://github.com/lohithpesala-08-05/health-hub-project/blob/main/server/src/models/Contact.js): `server/src/models/Contact.js`
- [Local JSON store](https://github.com/lohithpesala-08-05/health-hub-project/blob/main/server/src/services/dataStore.js): `server/src/services/dataStore.js`
- [MongoDB connection](https://github.com/lohithpesala-08-05/health-hub-project/blob/main/server/src/config/database.js): `server/src/config/database.js`

### Other components

- **Visitor**
- **Doctor**

## Connections

- Visitor → React app: uses (evidence: `README.md`)
- Doctor → React app: views bookings (evidence: `README.md`)
- React app → API client: calls (evidence: `client/src/App.jsx`)
- React app → Wellness tools: renders (evidence: `client/src/App.jsx`)
- React app → Wellness guidance: renders (evidence: `client/src/App.jsx`)
- React app → Account forms: renders (evidence: `client/src/App.jsx`)
- React app → Doctor bookings view: renders (evidence: `client/src/App.jsx`)
- API client → Express app: requests API (evidence: `README.md`)
- Express app → API routes: mounts (evidence: `server/src/app.js`)
- API routes → Authentication: routes auth (evidence: `server/src/routes/apiRoutes.js`)
- API routes → Appointment handling: routes bookings (evidence: `server/src/routes/apiRoutes.js`)
- API routes → Contact handling: routes messages (evidence: `server/src/routes/apiRoutes.js`)
- Authentication → Local JSON store: reads/writes (evidence: `server/src/controllers/authController.js`)
- Authentication → User records: queries (evidence: `server/src/controllers/authController.js`)
- Authentication → Doctor records: queries (evidence: `server/src/controllers/authController.js`)
- Authentication → Password hashing: verifies passwords (evidence: `server/src/controllers/authController.js`)
- Appointment handling → Local JSON store: reads/writes (evidence: `server/src/controllers/appointmentController.js`)
- Appointment handling → Appointment records: queries (evidence: `server/src/controllers/appointmentController.js`)
- Contact handling → Local JSON store: writes (evidence: `server/src/controllers/contactController.js`)
- Contact handling → Contact records: creates records (evidence: `server/src/controllers/contactController.js`)
- Express app → MongoDB connection: connects (evidence: `server/src/app.js`)
- MongoDB connection → Local JSON store: sets connection state (evidence: `server/src/config/database.js`)
- Legacy web routes → Legacy page rendering: routes pages (evidence: `server/src/routes/webRoutes.js`)
- Legacy page rendering → View registry: looks up views (evidence: `server/src/controllers/pageController.js`)
