# darshan0001-top/smartglove architecture

> Architecture diagram of the GitHub repository darshan0001-top/smartglove, 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/darshan0001-top/smartglove
- Repository: https://github.com/darshan0001-top/smartglove

## Overview

SmartGlove combines wearable gesture communication with a caregiver healthcare platform. The main path is glove sensor readings over Bluetooth to the browser, where gestures become text and speech; alerts and vitals can also reach the server for caregiver escalation. The backend additionally supports authentication, AI assistance, prescription analysis, and medicine adherence. Browser and server excerpts support the principal communication and alert flow; some feature wiring is documented in the README but its client implementation was not sampled.

Main entry points: [`server.js`](https://github.com/darshan0001-top/smartglove/blob/main/server.js) (Express server), [`services/notificationService.js`](https://github.com/darshan0001-top/smartglove/blob/main/services/notificationService.js) (Alert delivery), [`routes/medicineRoutes.js`](https://github.com/darshan0001-top/smartglove/blob/main/routes/medicineRoutes.js) (Medicine adherence), [`preview.jsx`](https://github.com/darshan0001-top/smartglove/blob/main/preview.jsx) (Care dashboard)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_device["Wearable communication"]
  node_glove["ESP32 glove"]
end

subgraph group_web["Browser experience"]
  node_browser["Care dashboard<br/>[preview.jsx]"]
  node_speech["Speech synthesis"]
end

subgraph group_backend["API and services"]
  node_server["Express server<br/>[server.js]"]
  node_gesture["Gesture alerts<br/>[server.js]"]
  node_auth["Authentication<br/>[authRoutes.js]"]
  node_ai["AI assistant<br/>[aiRoutes.js]"]
  node_prescription["Prescription analysis"]
  node_medicine["Medicine adherence<br/>[medicineRoutes.js]"]
  node_admin["Administration<br/>[adminRoutes.js]"]
  node_notify["Alert delivery"]
  node_email["Email delivery<br/>[emailService.js]"]
end

subgraph group_care["Care data"]
  node_mongo[("MongoDB<br/>[db.js]")]
  node_alerts[("Alert records<br/>[Alert.js]")]
  node_users[("User records<br/>[User.js]")]
  node_patientdata[("Patient records<br/>[Patient.js]")]
  node_medrecords[("Medicine records<br/>[Medicine.js]")]
  node_schedules[("Dose schedules")]
  node_notifications[("Notifications<br/>[Notification.js]")]
end

node_patient(("Patient"))
node_gemini["Gemini API"]
node_smtp["SMTP email"]
node_caregiver(("Care team"))

node_patient -->|"performs gestures"| node_glove
node_glove -->|"sends BLE data"| node_browser
node_browser -->|"speaks text"| node_speech
node_browser -->|"REST and sockets"| node_server
node_server -->|"handles gesture"| node_gesture
node_gesture -->|"creates alert"| node_alerts
node_gesture -->|"dispatches alert"| node_notify
node_notify -->|"resolves care team"| node_patientdata
node_notify -->|"finds recipients"| node_users
node_notify -->|"writes notices"| node_notifications
node_notify -->|"sends live alerts"| node_caregiver
node_notify -->|"requests email"| node_email
node_email -->|"sends email"| node_smtp
node_auth -->|"reads and updates"| node_users
node_auth -->|"uses patient data"| node_patientdata
node_server -->|"mounts routes"| node_auth
node_server -->|"mounts routes"| node_ai
node_server -->|"mounts routes"| node_prescription
node_server -->|"mounts routes"| node_medicine
node_server -->|"mounts routes"| node_admin
node_ai -.->|"generates responses"| node_gemini
node_prescription -.->|"analyzes images"| node_gemini
node_medicine -->|"reads and writes"| node_medrecords
node_medicine -->|"manages doses"| node_schedules
node_medicine -->|"records reminders"| node_notifications
node_admin -->|"manages accounts"| node_users
node_server -->|"connects database"| node_mongo

click node_glove "https://github.com/darshan0001-top/smartglove/blob/main/arduino_glove_code_UPDATED.ino"
click node_browser "https://github.com/darshan0001-top/smartglove/blob/main/preview.jsx"
click node_server "https://github.com/darshan0001-top/smartglove/blob/main/server.js"
click node_gesture "https://github.com/darshan0001-top/smartglove/blob/main/server.js"
click node_auth "https://github.com/darshan0001-top/smartglove/blob/main/routes/authRoutes.js"
click node_ai "https://github.com/darshan0001-top/smartglove/blob/main/routes/aiRoutes.js"
click node_prescription "https://github.com/darshan0001-top/smartglove/blob/main/routes/prescriptionAnalyzerRoutes.js"
click node_medicine "https://github.com/darshan0001-top/smartglove/blob/main/routes/medicineRoutes.js"
click node_admin "https://github.com/darshan0001-top/smartglove/blob/main/routes/adminRoutes.js"
click node_notify "https://github.com/darshan0001-top/smartglove/blob/main/services/notificationService.js"
click node_email "https://github.com/darshan0001-top/smartglove/blob/main/services/emailService.js"
click node_mongo "https://github.com/darshan0001-top/smartglove/blob/main/config/db.js"
click node_alerts "https://github.com/darshan0001-top/smartglove/blob/main/models/Alert.js"
click node_users "https://github.com/darshan0001-top/smartglove/blob/main/models/User.js"
click node_patientdata "https://github.com/darshan0001-top/smartglove/blob/main/models/Patient.js"
click node_medrecords "https://github.com/darshan0001-top/smartglove/blob/main/models/Medicine.js"
click node_schedules "https://github.com/darshan0001-top/smartglove/blob/main/models/MedicineSchedule.js"
click node_notifications "https://github.com/darshan0001-top/smartglove/blob/main/models/Notification.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_glove toneBlue
class node_browser,node_speech toneAmber
class node_server,node_gesture,node_auth,node_ai,node_prescription,node_medicine,node_admin,node_notify,node_email,node_gemini toneMint
class node_mongo,node_alerts,node_users,node_patientdata,node_medrecords,node_schedules,node_notifications toneRose
class node_patient,node_smtp,node_caregiver toneIndigo
```

## Components

### Wearable communication

- [ESP32 glove](https://github.com/darshan0001-top/smartglove/blob/main/arduino_glove_code_UPDATED.ino): `arduino_glove_code_UPDATED.ino`

### Browser experience

- [Care dashboard](https://github.com/darshan0001-top/smartglove/blob/main/preview.jsx): `preview.jsx`
- **Speech synthesis**

### API and services

- [Express server](https://github.com/darshan0001-top/smartglove/blob/main/server.js): `server.js`
- [Gesture alerts](https://github.com/darshan0001-top/smartglove/blob/main/server.js): `server.js`
- [Authentication](https://github.com/darshan0001-top/smartglove/blob/main/routes/authRoutes.js): `routes/authRoutes.js`
- [AI assistant](https://github.com/darshan0001-top/smartglove/blob/main/routes/aiRoutes.js): `routes/aiRoutes.js`
- [Prescription analysis](https://github.com/darshan0001-top/smartglove/blob/main/routes/prescriptionAnalyzerRoutes.js): `routes/prescriptionAnalyzerRoutes.js`
- [Medicine adherence](https://github.com/darshan0001-top/smartglove/blob/main/routes/medicineRoutes.js): `routes/medicineRoutes.js`
- [Administration](https://github.com/darshan0001-top/smartglove/blob/main/routes/adminRoutes.js): `routes/adminRoutes.js`
- [Alert delivery](https://github.com/darshan0001-top/smartglove/blob/main/services/notificationService.js): `services/notificationService.js`
- [Email delivery](https://github.com/darshan0001-top/smartglove/blob/main/services/emailService.js): `services/emailService.js`

### Care data

- [MongoDB](https://github.com/darshan0001-top/smartglove/blob/main/config/db.js): `config/db.js`
- [Alert records](https://github.com/darshan0001-top/smartglove/blob/main/models/Alert.js): `models/Alert.js`
- [User records](https://github.com/darshan0001-top/smartglove/blob/main/models/User.js): `models/User.js`
- [Patient records](https://github.com/darshan0001-top/smartglove/blob/main/models/Patient.js): `models/Patient.js`
- [Medicine records](https://github.com/darshan0001-top/smartglove/blob/main/models/Medicine.js): `models/Medicine.js`
- [Dose schedules](https://github.com/darshan0001-top/smartglove/blob/main/models/MedicineSchedule.js): `models/MedicineSchedule.js`
- [Notifications](https://github.com/darshan0001-top/smartglove/blob/main/models/Notification.js): `models/Notification.js`

### Other components

- **Patient**
- **Gemini API**
- **SMTP email**
- **Care team**

## Connections

- Patient → ESP32 glove: performs gestures
- ESP32 glove → Care dashboard: sends BLE data
- Care dashboard → Speech synthesis: speaks text
- Care dashboard → Express server: REST and sockets
- Express server → Gesture alerts: handles gesture
- Gesture alerts → Alert records: creates alert
- Gesture alerts → Alert delivery: dispatches alert
- Alert delivery → Patient records: resolves care team
- Alert delivery → User records: finds recipients
- Alert delivery → Notifications: writes notices
- Alert delivery → Care team: sends live alerts
- Alert delivery → Email delivery: requests email
- Email delivery → SMTP email: sends email
- Authentication → User records: reads and updates
- Authentication → Patient records: uses patient data
- Express server → Authentication: mounts routes
- Express server → AI assistant: mounts routes
- Express server → Prescription analysis: mounts routes
- Express server → Medicine adherence: mounts routes
- Express server → Administration: mounts routes
- AI assistant → Gemini API: generates responses
- Prescription analysis → Gemini API: analyzes images
- Medicine adherence → Medicine records: reads and writes
- Medicine adherence → Dose schedules: manages doses
- Medicine adherence → Notifications: records reminders
- Administration → User records: manages accounts
- Express server → MongoDB: connects database
