# kanvyhealth/dheergayush-backend architecture

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

- Interactive diagram: https://gitdiagram.com/kanvyhealth/dheergayush-backend
- Repository: https://github.com/kanvyhealth/dheergayush-backend

## Overview

This is a telemedicine and health-commerce backend serving patient, doctor, and admin workflows. Patients authenticate, book paid consultations, share reports, consult by video, and receive prescriptions; they can also browse a medicine store, pay for orders, and track fulfillment. Doctors manage profiles and availability and conduct consultations; admins manage doctors, payments, prescriptions, and orders. The graph emphasizes domain routes and their evidenced integrations. Source excerpts are partial and the README is empty, so some subsystem wiring is intentionally omitted.

Main entry points: [`src/core/data/index.js`](https://github.com/kanvyhealth/dheergayush-backend/blob/main/src/core/data/index.js) (Firestore data), [`src/modules/store/routes.js`](https://github.com/kanvyhealth/dheergayush-backend/blob/main/src/modules/store/routes.js) (Storefront and orders), [`src/modules/consultations/routes.js`](https://github.com/kanvyhealth/dheergayush-backend/blob/main/src/modules/consultations/routes.js) (Consultation workflow), [`src/server.js`](https://github.com/kanvyhealth/dheergayush-backend/blob/main/src/server.js) (HTTP server)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_platform["Platform"]
  node_server["HTTP server<br/>[server.js]"]
  node_application["Application routes<br/>[application.js]"]
  node_firestore[("Firestore data<br/>[index.js]")]
  node_storage["Firebase Storage<br/>[storage.js]"]
end

subgraph group_identity["Identity"]
  node_auth["Authentication<br/>[routes.js]"]
  node_patientdata["Patient services<br/>[routes.js]"]
  node_firebaseauth["Firebase Auth"]
end

subgraph group_care["Clinical care"]
  node_doctors["Doctor services<br/>[routes.js]"]
  node_consultations["Consultation workflow<br/>[routes.js]"]
  node_prescriptions["Prescriptions<br/>[routes.js]"]
  node_payments["Consultation payments<br/>[routes.js]"]
  node_razorpay["Razorpay"]
end

subgraph group_commerce["Health commerce"]
  node_store["Storefront and orders<br/>[routes.js]"]
  node_catalog["Store catalog<br/>[storeCatalog.js]"]
end

subgraph group_operations["Operations"]
  node_adminservices["Admin services<br/>[routes.js]"]
  node_analytics["Site analytics<br/>[routes.js]"]
end

node_patient(("Patient"))
node_doctor(("Doctor"))
node_admin(("Admin"))

node_patient -->|"requests"| node_server
node_doctor -->|"requests"| node_server
node_admin -->|"requests"| node_server
node_server -->|"starts"| node_application
node_patient -->|"signs in"| node_auth
node_auth -->|"authenticates"| node_firebaseauth
node_auth -->|"loads profile"| node_firestore
node_patient -->|"views history"| node_patientdata
node_patientdata -->|"reads records"| node_firestore
node_doctor -->|"manages profile"| node_doctors
node_doctors -->|"reads and writes"| node_firestore
node_patient -->|"pays to book"| node_payments
node_payments -->|"creates and verifies"| node_razorpay
node_payments -->|"records payment"| node_firestore
node_patient -->|"joins consultation"| node_consultations
node_doctor -->|"conducts consultation"| node_consultations
node_consultations -->|"loads room records"| node_firestore
node_patient -->|"views prescription"| node_prescriptions
node_prescriptions -->|"reads and writes"| node_firestore
node_patient -->|"places order"| node_store
node_store -->|"loads catalog"| node_catalog
node_store -->|"verifies payment"| node_razorpay
node_store -->|"reads and writes orders"| node_firestore
node_admin -->|"manages records"| node_adminservices
node_admin -->|"views statistics"| node_analytics
node_admin -->|"manages fulfillment"| node_store
node_consultations -.->|"stores reports"| node_storage

click node_server "https://github.com/kanvyhealth/dheergayush-backend/blob/main/src/server.js"
click node_application "https://github.com/kanvyhealth/dheergayush-backend/blob/main/src/application.js"
click node_auth "https://github.com/kanvyhealth/dheergayush-backend/blob/main/src/modules/auth/routes.js"
click node_patientdata "https://github.com/kanvyhealth/dheergayush-backend/blob/main/src/modules/patients/routes.js"
click node_doctors "https://github.com/kanvyhealth/dheergayush-backend/blob/main/src/modules/doctors/routes.js"
click node_consultations "https://github.com/kanvyhealth/dheergayush-backend/blob/main/src/modules/consultations/routes.js"
click node_prescriptions "https://github.com/kanvyhealth/dheergayush-backend/blob/main/src/modules/prescriptions/routes.js"
click node_payments "https://github.com/kanvyhealth/dheergayush-backend/blob/main/src/modules/payments/routes.js"
click node_store "https://github.com/kanvyhealth/dheergayush-backend/blob/main/src/modules/store/routes.js"
click node_catalog "https://github.com/kanvyhealth/dheergayush-backend/blob/main/src/modules/store/storeCatalog.js"
click node_adminservices "https://github.com/kanvyhealth/dheergayush-backend/blob/main/src/modules/admin/routes.js"
click node_analytics "https://github.com/kanvyhealth/dheergayush-backend/blob/main/src/modules/analytics/routes.js"
click node_firestore "https://github.com/kanvyhealth/dheergayush-backend/blob/main/src/core/data/index.js"
click node_storage "https://github.com/kanvyhealth/dheergayush-backend/blob/main/src/core/firebase/storage.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_server,node_application,node_firestore,node_storage toneBlue
class node_auth,node_patientdata,node_firebaseauth toneAmber
class node_doctors,node_consultations,node_prescriptions,node_payments,node_razorpay toneMint
class node_store,node_catalog toneRose
class node_adminservices,node_analytics,node_patient,node_doctor,node_admin toneIndigo
```

## Components

### Platform

- [HTTP server](https://github.com/kanvyhealth/dheergayush-backend/blob/main/src/server.js): `src/server.js`
- [Application routes](https://github.com/kanvyhealth/dheergayush-backend/blob/main/src/application.js): `src/application.js`
- [Firestore data](https://github.com/kanvyhealth/dheergayush-backend/blob/main/src/core/data/index.js): `src/core/data/index.js`
- [Firebase Storage](https://github.com/kanvyhealth/dheergayush-backend/blob/main/src/core/firebase/storage.js): `src/core/firebase/storage.js`

### Identity

- [Authentication](https://github.com/kanvyhealth/dheergayush-backend/blob/main/src/modules/auth/routes.js): `src/modules/auth/routes.js`
- [Patient services](https://github.com/kanvyhealth/dheergayush-backend/blob/main/src/modules/patients/routes.js): `src/modules/patients/routes.js`
- **Firebase Auth**

### Clinical care

- [Doctor services](https://github.com/kanvyhealth/dheergayush-backend/blob/main/src/modules/doctors/routes.js): `src/modules/doctors/routes.js`
- [Consultation workflow](https://github.com/kanvyhealth/dheergayush-backend/blob/main/src/modules/consultations/routes.js): `src/modules/consultations/routes.js`
- [Prescriptions](https://github.com/kanvyhealth/dheergayush-backend/blob/main/src/modules/prescriptions/routes.js): `src/modules/prescriptions/routes.js`
- [Consultation payments](https://github.com/kanvyhealth/dheergayush-backend/blob/main/src/modules/payments/routes.js): `src/modules/payments/routes.js`
- **Razorpay**

### Health commerce

- [Storefront and orders](https://github.com/kanvyhealth/dheergayush-backend/blob/main/src/modules/store/routes.js): `src/modules/store/routes.js`
- [Store catalog](https://github.com/kanvyhealth/dheergayush-backend/blob/main/src/modules/store/storeCatalog.js): `src/modules/store/storeCatalog.js`

### Operations

- [Admin services](https://github.com/kanvyhealth/dheergayush-backend/blob/main/src/modules/admin/routes.js): `src/modules/admin/routes.js`
- [Site analytics](https://github.com/kanvyhealth/dheergayush-backend/blob/main/src/modules/analytics/routes.js): `src/modules/analytics/routes.js`

### Other components

- **Patient**
- **Doctor**
- **Admin**

## Connections

- Patient → HTTP server: requests
- Doctor → HTTP server: requests
- Admin → HTTP server: requests
- HTTP server → Application routes: starts
- Patient → Authentication: signs in
- Authentication → Firebase Auth: authenticates
- Authentication → Firestore data: loads profile
- Patient → Patient services: views history
- Patient services → Firestore data: reads records
- Doctor → Doctor services: manages profile
- Doctor services → Firestore data: reads and writes
- Patient → Consultation payments: pays to book
- Consultation payments → Razorpay: creates and verifies
- Consultation payments → Firestore data: records payment
- Patient → Consultation workflow: joins consultation
- Doctor → Consultation workflow: conducts consultation
- Consultation workflow → Firestore data: loads room records
- Patient → Prescriptions: views prescription
- Prescriptions → Firestore data: reads and writes
- Patient → Storefront and orders: places order
- Storefront and orders → Store catalog: loads catalog
- Storefront and orders → Razorpay: verifies payment
- Storefront and orders → Firestore data: reads and writes orders
- Admin → Admin services: manages records
- Admin → Site analytics: views statistics
- Admin → Storefront and orders: manages fulfillment
- Consultation workflow → Firebase Storage: stores reports
