# ruchiranagre/medichoice architecture

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

- Interactive diagram: https://gitdiagram.com/ruchiranagre/medichoice
- Repository: https://github.com/ruchiranagre/medichoice

## Overview

MediChoice is a healthcare discovery and planning platform: users browse hospitals, doctors, and treatment information, compare options and estimate costs, then can register and book appointments. Its React frontend routes these experiences; an Express/MongoDB backend serves hospital, doctor, authentication, and appointment APIs, while a separate chatbot service uses curated datasets and Groq. README capabilities such as cost insights and treatment duration are represented, but unsampled frontend-to-backend wiring is omitted unless shown by an excerpt or index.

Main entry points: [`frontend/src/App.jsx`](https://github.com/ruchiranagre/medichoice/blob/main/frontend/src/App.jsx) (Frontend router), [`backend/app.js`](https://github.com/ruchiranagre/medichoice/blob/main/backend/app.js) (Express API router), [`backend/routes/showHospitalRoutes.js`](https://github.com/ruchiranagre/medichoice/blob/main/backend/routes/showHospitalRoutes.js) (Hospital detail and reviews), [`backend/routes/appointmentRoutes.js`](https://github.com/ruchiranagre/medichoice/blob/main/backend/routes/appointmentRoutes.js) (Appointment endpoints)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Discovery and planning"]
  node_app["Frontend router<br/>[App.jsx]"]
  node_hospital_browse["Hospital discovery<br/>[HospitalsAll.jsx]"]
  node_hospital_detail["Hospital profile<br/>[ShowHospital.jsx]"]
  node_doctor_detail["Doctor profile<br/>[ShowDoctor.jsx]"]
  node_treatment["Treatment information<br/>[TreatmentInfo.jsx]"]
  node_treatment_catalog["Treatment catalog<br/>[AllTreatments.jsx]"]
  node_comparison["Option comparison<br/>[Comparison.jsx]"]
  node_cost_estimator["Cost estimator<br/>[Estimator.jsx]"]
end

subgraph group_accounts["Accounts and care"]
  node_signup["Registration<br/>[SignUp.jsx]"]
  node_login["Login<br/>[Login.jsx]"]
  node_booking["Appointment booking"]
  node_patient_dashboard["Patient dashboard"]
  node_doctor_dashboard["Doctor dashboard<br/>[Dashboard.jsx]"]
end

subgraph group_backend["Healthcare API"]
  node_api["Express API router<br/>[app.js]"]
  node_hospital_api["Hospital endpoints<br/>[hospitalRoutes.js]"]
  node_hospital_detail_api["Hospital detail and reviews"]
  node_doctor_api["Doctor endpoints<br/>[doctorRoutes.js]"]
  node_comparison_api["Comparison endpoint"]
  node_appointment_api["Appointment endpoints"]
  node_auth_api["Authentication endpoints<br/>[authRoutes.js]"]
  node_auth_middleware["Token protection<br/>[authMiddleware.js]"]
  node_hospital_model[("Hospital records<br/>[Hospitals.js]")]
  node_doctor_model[("Doctor records<br/>[Doctors.js]")]
  node_user_model[("User records<br/>[User.js]")]
  node_appointment_model[("Appointment records<br/>[Appointment.js]")]
end

subgraph group_assistant["Chat assistant"]
  node_chat_widget["Chat widget<br/>[ChatWidget.jsx]"]
  node_chat_service["Chat service<br/>[server.js]"]
  node_chat_data["Curated doctor and hospital data<br/>[dData.js]"]
end

node_visitor(("Healthcare seeker"))
node_groq{{"Groq language model"}}

node_visitor -->|"browses"| node_app
node_app -->|"routes to"| node_hospital_browse
node_app -->|"routes to"| node_hospital_detail
node_app -->|"routes to"| node_doctor_detail
node_app -->|"routes to"| node_treatment
node_app -->|"routes to"| node_treatment_catalog
node_app -->|"routes to"| node_comparison
node_app -->|"routes to"| node_cost_estimator
node_app -->|"routes to"| node_signup
node_app -->|"routes to"| node_login
node_app -->|"routes to"| node_booking
node_app -->|"routes to"| node_patient_dashboard
node_app -->|"routes to"| node_doctor_dashboard
node_app -->|"renders"| node_chat_widget
node_api -->|"mounts"| node_hospital_api
node_api -->|"mounts"| node_hospital_detail_api
node_api -->|"mounts"| node_doctor_api
node_api -->|"mounts"| node_comparison_api
node_api -->|"mounts"| node_appointment_api
node_api -->|"mounts"| node_auth_api
node_hospital_api -->|"queries"| node_hospital_model
node_hospital_detail_api -->|"reads and updates"| node_hospital_model
node_doctor_api -->|"queries"| node_doctor_model
node_comparison_api -->|"queries"| node_hospital_model
node_appointment_api -->|"reads and writes"| node_appointment_model
node_appointment_api -->|"protects routes"| node_auth_middleware
node_hospital_detail_api -->|"protects reviews"| node_auth_middleware
node_auth_middleware -->|"loads user"| node_user_model
node_auth_api -->|"registers and authenticates"| node_user_model
node_auth_api -->|"creates doctor profile"| node_doctor_model
node_hospital_detail -->|"fetches and submits reviews"| node_hospital_detail_api
node_chat_service -->|"loads datasets"| node_chat_data
node_chat_service -->|"requests completion"| node_groq

click node_app "https://github.com/ruchiranagre/medichoice/blob/main/frontend/src/App.jsx"
click node_hospital_browse "https://github.com/ruchiranagre/medichoice/blob/main/frontend/src/pages/HospitalsAll/HospitalsAll.jsx"
click node_hospital_detail "https://github.com/ruchiranagre/medichoice/blob/main/frontend/src/pages/ShowHospital/ShowHospital.jsx"
click node_doctor_detail "https://github.com/ruchiranagre/medichoice/blob/main/frontend/src/pages/ShowDoctor/ShowDoctor.jsx"
click node_treatment "https://github.com/ruchiranagre/medichoice/blob/main/frontend/src/pages/TreatmentInfo/TreatmentInfo.jsx"
click node_treatment_catalog "https://github.com/ruchiranagre/medichoice/blob/main/frontend/src/pages/AllTreatments/AllTreatments.jsx"
click node_comparison "https://github.com/ruchiranagre/medichoice/blob/main/frontend/src/pages/Comparison/Comparison.jsx"
click node_cost_estimator "https://github.com/ruchiranagre/medichoice/blob/main/frontend/src/pages/Estimator/Estimator.jsx"
click node_signup "https://github.com/ruchiranagre/medichoice/blob/main/frontend/src/components/SignUp/SignUp.jsx"
click node_login "https://github.com/ruchiranagre/medichoice/blob/main/frontend/src/components/Login/Login.jsx"
click node_booking "https://github.com/ruchiranagre/medichoice/blob/main/frontend/src/pages/BookAppointment/BookAppointment.jsx"
click node_patient_dashboard "https://github.com/ruchiranagre/medichoice/blob/main/frontend/src/pages/Dashboards/PatientDashboard.jsx"
click node_doctor_dashboard "https://github.com/ruchiranagre/medichoice/blob/main/frontend/src/pages/DoctorDashboard/Dashboard.jsx"
click node_api "https://github.com/ruchiranagre/medichoice/blob/main/backend/app.js"
click node_hospital_api "https://github.com/ruchiranagre/medichoice/blob/main/backend/routes/hospitalRoutes.js"
click node_hospital_detail_api "https://github.com/ruchiranagre/medichoice/blob/main/backend/routes/showHospitalRoutes.js"
click node_doctor_api "https://github.com/ruchiranagre/medichoice/blob/main/backend/routes/doctorRoutes.js"
click node_comparison_api "https://github.com/ruchiranagre/medichoice/blob/main/backend/routes/comparisonRoutes.js"
click node_appointment_api "https://github.com/ruchiranagre/medichoice/blob/main/backend/routes/appointmentRoutes.js"
click node_auth_api "https://github.com/ruchiranagre/medichoice/blob/main/backend/routes/authRoutes.js"
click node_auth_middleware "https://github.com/ruchiranagre/medichoice/blob/main/backend/middleware/authMiddleware.js"
click node_hospital_model "https://github.com/ruchiranagre/medichoice/blob/main/backend/models/Hospitals.js"
click node_doctor_model "https://github.com/ruchiranagre/medichoice/blob/main/backend/models/Doctors.js"
click node_user_model "https://github.com/ruchiranagre/medichoice/blob/main/backend/models/User.js"
click node_appointment_model "https://github.com/ruchiranagre/medichoice/blob/main/backend/models/Appointment.js"
click node_chat_widget "https://github.com/ruchiranagre/medichoice/blob/main/frontend/src/components/ChatWidget.jsx"
click node_chat_service "https://github.com/ruchiranagre/medichoice/blob/main/chatbot-service/server.js"
click node_chat_data "https://github.com/ruchiranagre/medichoice/blob/main/chatbot-service/dData.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_app,node_hospital_browse,node_hospital_detail,node_doctor_detail,node_treatment,node_treatment_catalog,node_comparison,node_cost_estimator toneBlue
class node_signup,node_login,node_booking,node_patient_dashboard,node_doctor_dashboard toneAmber
class node_api,node_hospital_api,node_hospital_detail_api,node_doctor_api,node_comparison_api,node_appointment_api,node_auth_api,node_auth_middleware,node_hospital_model,node_doctor_model,node_user_model,node_appointment_model toneMint
class node_chat_widget,node_chat_service,node_chat_data toneRose
class node_visitor,node_groq toneIndigo
```

## Components

### Discovery and planning

- [Frontend router](https://github.com/ruchiranagre/medichoice/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Hospital discovery](https://github.com/ruchiranagre/medichoice/blob/main/frontend/src/pages/HospitalsAll/HospitalsAll.jsx): `frontend/src/pages/HospitalsAll/HospitalsAll.jsx`
- [Hospital profile](https://github.com/ruchiranagre/medichoice/blob/main/frontend/src/pages/ShowHospital/ShowHospital.jsx): `frontend/src/pages/ShowHospital/ShowHospital.jsx`
- [Doctor profile](https://github.com/ruchiranagre/medichoice/blob/main/frontend/src/pages/ShowDoctor/ShowDoctor.jsx): `frontend/src/pages/ShowDoctor/ShowDoctor.jsx`
- [Treatment information](https://github.com/ruchiranagre/medichoice/blob/main/frontend/src/pages/TreatmentInfo/TreatmentInfo.jsx): `frontend/src/pages/TreatmentInfo/TreatmentInfo.jsx`
- [Treatment catalog](https://github.com/ruchiranagre/medichoice/blob/main/frontend/src/pages/AllTreatments/AllTreatments.jsx): `frontend/src/pages/AllTreatments/AllTreatments.jsx`
- [Option comparison](https://github.com/ruchiranagre/medichoice/blob/main/frontend/src/pages/Comparison/Comparison.jsx): `frontend/src/pages/Comparison/Comparison.jsx`
- [Cost estimator](https://github.com/ruchiranagre/medichoice/blob/main/frontend/src/pages/Estimator/Estimator.jsx): `frontend/src/pages/Estimator/Estimator.jsx`

### Accounts and care

- [Registration](https://github.com/ruchiranagre/medichoice/blob/main/frontend/src/components/SignUp/SignUp.jsx): `frontend/src/components/SignUp/SignUp.jsx`
- [Login](https://github.com/ruchiranagre/medichoice/blob/main/frontend/src/components/Login/Login.jsx): `frontend/src/components/Login/Login.jsx`
- [Appointment booking](https://github.com/ruchiranagre/medichoice/blob/main/frontend/src/pages/BookAppointment/BookAppointment.jsx): `frontend/src/pages/BookAppointment/BookAppointment.jsx`
- [Patient dashboard](https://github.com/ruchiranagre/medichoice/blob/main/frontend/src/pages/Dashboards/PatientDashboard.jsx): `frontend/src/pages/Dashboards/PatientDashboard.jsx`
- [Doctor dashboard](https://github.com/ruchiranagre/medichoice/blob/main/frontend/src/pages/DoctorDashboard/Dashboard.jsx): `frontend/src/pages/DoctorDashboard/Dashboard.jsx`

### Healthcare API

- [Express API router](https://github.com/ruchiranagre/medichoice/blob/main/backend/app.js): `backend/app.js`
- [Hospital endpoints](https://github.com/ruchiranagre/medichoice/blob/main/backend/routes/hospitalRoutes.js): `backend/routes/hospitalRoutes.js`
- [Hospital detail and reviews](https://github.com/ruchiranagre/medichoice/blob/main/backend/routes/showHospitalRoutes.js): `backend/routes/showHospitalRoutes.js`
- [Doctor endpoints](https://github.com/ruchiranagre/medichoice/blob/main/backend/routes/doctorRoutes.js): `backend/routes/doctorRoutes.js`
- [Comparison endpoint](https://github.com/ruchiranagre/medichoice/blob/main/backend/routes/comparisonRoutes.js): `backend/routes/comparisonRoutes.js`
- [Appointment endpoints](https://github.com/ruchiranagre/medichoice/blob/main/backend/routes/appointmentRoutes.js): `backend/routes/appointmentRoutes.js`
- [Authentication endpoints](https://github.com/ruchiranagre/medichoice/blob/main/backend/routes/authRoutes.js): `backend/routes/authRoutes.js`
- [Token protection](https://github.com/ruchiranagre/medichoice/blob/main/backend/middleware/authMiddleware.js): `backend/middleware/authMiddleware.js`
- [Hospital records](https://github.com/ruchiranagre/medichoice/blob/main/backend/models/Hospitals.js): `backend/models/Hospitals.js`
- [Doctor records](https://github.com/ruchiranagre/medichoice/blob/main/backend/models/Doctors.js): `backend/models/Doctors.js`
- [User records](https://github.com/ruchiranagre/medichoice/blob/main/backend/models/User.js): `backend/models/User.js`
- [Appointment records](https://github.com/ruchiranagre/medichoice/blob/main/backend/models/Appointment.js): `backend/models/Appointment.js`

### Chat assistant

- [Chat widget](https://github.com/ruchiranagre/medichoice/blob/main/frontend/src/components/ChatWidget.jsx): `frontend/src/components/ChatWidget.jsx`
- [Chat service](https://github.com/ruchiranagre/medichoice/blob/main/chatbot-service/server.js): `chatbot-service/server.js`
- [Curated doctor and hospital data](https://github.com/ruchiranagre/medichoice/blob/main/chatbot-service/dData.js): `chatbot-service/dData.js`

### Other components

- **Healthcare seeker**
- **Groq language model**

## Connections

- Healthcare seeker → Frontend router: browses (evidence: `frontend/src/App.jsx`)
- Frontend router → Hospital discovery: routes to (evidence: `frontend/src/App.jsx`)
- Frontend router → Hospital profile: routes to (evidence: `frontend/src/App.jsx`)
- Frontend router → Doctor profile: routes to (evidence: `frontend/src/App.jsx`)
- Frontend router → Treatment information: routes to (evidence: `frontend/src/App.jsx`)
- Frontend router → Treatment catalog: routes to (evidence: `frontend/src/App.jsx`)
- Frontend router → Option comparison: routes to (evidence: `frontend/src/App.jsx`)
- Frontend router → Cost estimator: routes to (evidence: `frontend/src/App.jsx`)
- Frontend router → Registration: routes to (evidence: `frontend/src/App.jsx`)
- Frontend router → Login: routes to (evidence: `frontend/src/App.jsx`)
- Frontend router → Appointment booking: routes to (evidence: `frontend/src/App.jsx`)
- Frontend router → Patient dashboard: routes to (evidence: `frontend/src/App.jsx`)
- Frontend router → Doctor dashboard: routes to (evidence: `frontend/src/App.jsx`)
- Frontend router → Chat widget: renders (evidence: `frontend/src/App.jsx`)
- Express API router → Hospital endpoints: mounts (evidence: `backend/app.js`)
- Express API router → Hospital detail and reviews: mounts (evidence: `backend/app.js`)
- Express API router → Doctor endpoints: mounts (evidence: `backend/app.js`)
- Express API router → Comparison endpoint: mounts (evidence: `backend/app.js`)
- Express API router → Appointment endpoints: mounts (evidence: `backend/app.js`)
- Express API router → Authentication endpoints: mounts (evidence: `backend/app.js`)
- Hospital endpoints → Hospital records: queries (evidence: `backend/routes/hospitalRoutes.js`)
- Hospital detail and reviews → Hospital records: reads and updates (evidence: `backend/routes/showHospitalRoutes.js`)
- Doctor endpoints → Doctor records: queries (evidence: `backend/routes/doctorRoutes.js`)
- Comparison endpoint → Hospital records: queries (evidence: `backend/routes/comparisonRoutes.js`)
- Appointment endpoints → Appointment records: reads and writes (evidence: `backend/routes/appointmentRoutes.js`)
- Appointment endpoints → Token protection: protects routes (evidence: `backend/routes/appointmentRoutes.js`)
- Hospital detail and reviews → Token protection: protects reviews (evidence: `backend/routes/showHospitalRoutes.js`)
- Token protection → User records: loads user (evidence: `backend/middleware/authMiddleware.js`)
- Authentication endpoints → User records: registers and authenticates (evidence: `backend/routes/authRoutes.js`)
- Authentication endpoints → Doctor records: creates doctor profile (evidence: `backend/routes/authRoutes.js`)
- Hospital profile → Hospital detail and reviews: fetches and submits reviews (evidence: `frontend/src/pages/ShowHospital/ShowHospital.jsx`)
- Chat service → Curated doctor and hospital data: loads datasets (evidence: `chatbot-service/server.js`)
- Chat service → Groq language model: requests completion (evidence: `chatbot-service/server.js`)
