# shubham2095/nidan architecture

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

- Interactive diagram: https://gitdiagram.com/shubham2095/nidan
- Repository: https://github.com/shubham2095/nidan

## Overview

NIDAN is a clinic website with online appointment booking and a staff CRM. Visitors browse clinic information and submit bookings or enquiries; staff authenticate to manage appointments, patients, leads, follow-ups, vaccinations, and site content. The React app routes public and admin experiences to an Express API, whose services implement business operations over Sequelize models and a MySQL/MariaDB database. The README documents additional booking, SEO, and content capabilities; several implementation paths below are directory-level because their source was not sampled.

Main entry points: [`client/src/App.jsx`](https://github.com/shubham2095/nidan/blob/main/client/src/App.jsx) (Admin Pages), [`server/models/index.js`](https://github.com/shubham2095/nidan/blob/main/server/models/index.js) (Clinic Models), [`server/routes/index.js`](https://github.com/shubham2095/nidan/blob/main/server/routes/index.js) (API Routes), [`server/services/booking.service.js`](https://github.com/shubham2095/nidan/blob/main/server/services/booking.service.js) (Booking Engine)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Public Website"]
  node_public_app["Public Pages<br/>[App.jsx]"]
  node_site_data["Site Content<br/>[SiteContext.jsx]"]
  node_booking_ui["Booking Flow"]
end

subgraph group_staff["Clinic CRM"]
  node_admin_app["Admin Pages<br/>[App.jsx]"]
  node_patient_ops["Patient Records"]
  node_lead_ops["Leads Follow-ups<br/>[LeadsPage.jsx]"]
  node_appointment_ops["Appointments"]
  node_vaccine_ops["Vaccination Tracker"]
  node_content_ops["Content Admin"]
end

subgraph group_api["API and Services"]
  node_server["Express API<br/>[server.js]"]
  node_route_map["API Routes<br/>[index.js]"]
  node_public_api["Public Content API"]
  node_crm_api["CRM Controllers<br/>[crm.controller.js]"]
  node_patient_api["Patient Controller"]
  node_auth_gate["Session and Roles<br/>[auth.js]"]
  node_booking_logic["Booking Engine<br/>[booking.service.js]"]
  node_public_logic["Public Content"]
  node_lead_logic["Lead Service<br/>[lead.service.js]"]
  node_patient_logic["Patient Service<br/>[patient.service.js]"]
end

subgraph group_data["Clinic Data"]
  node_clinic_models["Clinic Models<br/>[index.js]"]
  node_database[("MySQL Database<br/>[db.js]")]
end

node_visitor(("Visitor"))
node_staff_user(("Clinic Staff"))
node_mail["SMTP Email"]

node_visitor -->|"browses"| node_public_app
node_public_app -->|"loads site data"| node_site_data
node_public_app -->|"routes to booking"| node_booking_ui
node_booking_ui -.->|"submits booking"| node_booking_logic
node_staff_user -->|"uses CRM"| node_admin_app
node_admin_app -->|"routes to records"| node_patient_ops
node_admin_app -->|"routes to leads"| node_lead_ops
node_admin_app -->|"routes to appointments"| node_appointment_ops
node_admin_app -->|"routes to vaccinations"| node_vaccine_ops
node_admin_app -->|"routes to content tools"| node_content_ops
node_server -->|"mounts API routes"| node_route_map
node_route_map -->|"guards staff routes"| node_auth_gate
node_route_map -->|"dispatches CRM requests"| node_crm_api
node_route_map -->|"dispatches patient requests"| node_patient_api
node_crm_api -->|"calls lead service"| node_lead_logic
node_patient_api -->|"calls patient service"| node_patient_logic
node_public_api -->|"calls content service"| node_public_logic
node_public_api -->|"creates enquiry lead"| node_lead_logic
node_booking_logic -.->|"uses booking models"| node_clinic_models
node_public_logic -->|"reads content models"| node_clinic_models
node_lead_logic -->|"reads and writes"| node_clinic_models
node_patient_logic -.->|"uses patient models"| node_clinic_models
node_clinic_models -->|"persists records"| node_database
node_booking_logic -.->|"sends booking email"| node_mail

click node_public_app "https://github.com/shubham2095/nidan/blob/main/client/src/App.jsx"
click node_site_data "https://github.com/shubham2095/nidan/blob/main/client/src/context/SiteContext.jsx"
click node_booking_ui "https://github.com/shubham2095/nidan/blob/main/client/src/pages/public/BookAppointmentPage.jsx"
click node_admin_app "https://github.com/shubham2095/nidan/blob/main/client/src/App.jsx"
click node_patient_ops "https://github.com/shubham2095/nidan/blob/main/client/src/pages/admin/PatientDetailPage.jsx"
click node_lead_ops "https://github.com/shubham2095/nidan/blob/main/client/src/pages/admin/LeadsPage.jsx"
click node_appointment_ops "https://github.com/shubham2095/nidan/blob/main/client/src/pages/admin/AppointmentsPage.jsx"
click node_vaccine_ops "https://github.com/shubham2095/nidan/blob/main/client/src/pages/admin/VaccinationsPage.jsx"
click node_content_ops "https://github.com/shubham2095/nidan/blob/main/client/src/components/admin/ResourceManager.jsx"
click node_server "https://github.com/shubham2095/nidan/blob/main/server/server.js"
click node_route_map "https://github.com/shubham2095/nidan/blob/main/server/routes/index.js"
click node_public_api "https://github.com/shubham2095/nidan/blob/main/server/controllers/public.controller.js"
click node_crm_api "https://github.com/shubham2095/nidan/blob/main/server/controllers/crm.controller.js"
click node_patient_api "https://github.com/shubham2095/nidan/blob/main/server/controllers/patient.controller.js"
click node_auth_gate "https://github.com/shubham2095/nidan/blob/main/server/middleware/auth.js"
click node_booking_logic "https://github.com/shubham2095/nidan/blob/main/server/services/booking.service.js"
click node_public_logic "https://github.com/shubham2095/nidan/blob/main/server/services/publicContent.service.js"
click node_lead_logic "https://github.com/shubham2095/nidan/blob/main/server/services/lead.service.js"
click node_patient_logic "https://github.com/shubham2095/nidan/blob/main/server/services/patient.service.js"
click node_clinic_models "https://github.com/shubham2095/nidan/blob/main/server/models/index.js"
click node_database "https://github.com/shubham2095/nidan/blob/main/server/config/db.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_public_app,node_site_data,node_booking_ui toneBlue
class node_admin_app,node_patient_ops,node_lead_ops,node_appointment_ops,node_vaccine_ops,node_content_ops toneAmber
class node_server,node_route_map,node_public_api,node_crm_api,node_patient_api,node_auth_gate,node_booking_logic,node_public_logic,node_lead_logic,node_patient_logic toneMint
class node_clinic_models,node_database toneRose
class node_visitor,node_staff_user,node_mail toneIndigo
```

## Components

### Public Website

- [Public Pages](https://github.com/shubham2095/nidan/blob/main/client/src/App.jsx): `client/src/App.jsx`
- [Site Content](https://github.com/shubham2095/nidan/blob/main/client/src/context/SiteContext.jsx): `client/src/context/SiteContext.jsx`
- [Booking Flow](https://github.com/shubham2095/nidan/blob/main/client/src/pages/public/BookAppointmentPage.jsx): `client/src/pages/public/BookAppointmentPage.jsx`

### Clinic CRM

- [Admin Pages](https://github.com/shubham2095/nidan/blob/main/client/src/App.jsx): `client/src/App.jsx`
- [Patient Records](https://github.com/shubham2095/nidan/blob/main/client/src/pages/admin/PatientDetailPage.jsx): `client/src/pages/admin/PatientDetailPage.jsx`
- [Leads Follow-ups](https://github.com/shubham2095/nidan/blob/main/client/src/pages/admin/LeadsPage.jsx): `client/src/pages/admin/LeadsPage.jsx`
- [Appointments](https://github.com/shubham2095/nidan/blob/main/client/src/pages/admin/AppointmentsPage.jsx): `client/src/pages/admin/AppointmentsPage.jsx`
- [Vaccination Tracker](https://github.com/shubham2095/nidan/blob/main/client/src/pages/admin/VaccinationsPage.jsx): `client/src/pages/admin/VaccinationsPage.jsx`
- [Content Admin](https://github.com/shubham2095/nidan/blob/main/client/src/components/admin/ResourceManager.jsx): `client/src/components/admin/ResourceManager.jsx`

### API and Services

- [Express API](https://github.com/shubham2095/nidan/blob/main/server/server.js): `server/server.js`
- [API Routes](https://github.com/shubham2095/nidan/blob/main/server/routes/index.js): `server/routes/index.js`
- [Public Content API](https://github.com/shubham2095/nidan/blob/main/server/controllers/public.controller.js): `server/controllers/public.controller.js`
- [CRM Controllers](https://github.com/shubham2095/nidan/blob/main/server/controllers/crm.controller.js): `server/controllers/crm.controller.js`
- [Patient Controller](https://github.com/shubham2095/nidan/blob/main/server/controllers/patient.controller.js): `server/controllers/patient.controller.js`
- [Session and Roles](https://github.com/shubham2095/nidan/blob/main/server/middleware/auth.js): `server/middleware/auth.js`
- [Booking Engine](https://github.com/shubham2095/nidan/blob/main/server/services/booking.service.js): `server/services/booking.service.js`
- [Public Content](https://github.com/shubham2095/nidan/blob/main/server/services/publicContent.service.js): `server/services/publicContent.service.js`
- [Lead Service](https://github.com/shubham2095/nidan/blob/main/server/services/lead.service.js): `server/services/lead.service.js`
- [Patient Service](https://github.com/shubham2095/nidan/blob/main/server/services/patient.service.js): `server/services/patient.service.js`

### Clinic Data

- [Clinic Models](https://github.com/shubham2095/nidan/blob/main/server/models/index.js): `server/models/index.js`
- [MySQL Database](https://github.com/shubham2095/nidan/blob/main/server/config/db.js): `server/config/db.js`

### Other components

- **Visitor**
- **Clinic Staff**
- **SMTP Email**

## Connections

- Visitor → Public Pages: browses (evidence: `README.md`)
- Public Pages → Site Content: loads site data (evidence: `client/src/context/SiteContext.jsx`)
- Public Pages → Booking Flow: routes to booking (evidence: `client/src/App.jsx`)
- Booking Flow → Booking Engine: submits booking (evidence: `README.md`)
- Clinic Staff → Admin Pages: uses CRM (evidence: `README.md`)
- Admin Pages → Patient Records: routes to records (evidence: `client/src/App.jsx`)
- Admin Pages → Leads Follow-ups: routes to leads (evidence: `client/src/App.jsx`)
- Admin Pages → Appointments: routes to appointments (evidence: `client/src/App.jsx`)
- Admin Pages → Vaccination Tracker: routes to vaccinations (evidence: `client/src/App.jsx`)
- Admin Pages → Content Admin: routes to content tools (evidence: `client/src/App.jsx`)
- Express API → API Routes: mounts API routes (evidence: `server/server.js`)
- API Routes → Session and Roles: guards staff routes
- API Routes → CRM Controllers: dispatches CRM requests
- API Routes → Patient Controller: dispatches patient requests
- CRM Controllers → Lead Service: calls lead service (evidence: `server/controllers/crm.controller.js`)
- Patient Controller → Patient Service: calls patient service (evidence: `server/controllers/patient.controller.js`)
- Public Content API → Public Content: calls content service (evidence: `server/controllers/public.controller.js`)
- Public Content API → Lead Service: creates enquiry lead (evidence: `server/controllers/public.controller.js`)
- Booking Engine → Clinic Models: uses booking models
- Public Content → Clinic Models: reads content models (evidence: `server/services/publicContent.service.js`)
- Lead Service → Clinic Models: reads and writes (evidence: `server/services/lead.service.js`)
- Patient Service → Clinic Models: uses patient models
- Clinic Models → MySQL Database: persists records (evidence: `server/models/index.js`)
- Booking Engine → SMTP Email: sends booking email (evidence: `README.md`)
