# harshat55/mindcare architecture

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

- Interactive diagram: https://gitdiagram.com/harshat55/mindcare
- Repository: https://github.com/harshat55/mindcare

## Overview

MindCare is a dementia-care companion and caregiver web app. Patients use the companion, manage daily routines and memories, and complete cognitive checks; caregivers review care metrics and receive real-time patient alerts. The server exposes route-backed records and a Socket.IO notification channel. The README is empty, and several frontend and server excerpts are partial, so uncertain client wiring and unsampled integrations are omitted.

Main entry points: [`server.js`](https://github.com/harshat55/mindcare/blob/main/server.js) (HTTP and socket server), [`backend/db.js`](https://github.com/harshat55/mindcare/blob/main/backend/db.js) (Care records store), [`main.js`](https://github.com/harshat55/mindcare/blob/main/main.js) (Home controller), [`socket-client.js`](https://github.com/harshat55/mindcare/blob/main/socket-client.js) (Realtime client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_patient["Patient experience"]
  node_home["Home experience<br/>[index.html]"]
  node_companion["AI companion<br/>[companion.html]"]
  node_companion_logic["Companion interactions<br/>[companion.js]"]
  node_routines["Daily routines<br/>[routine.html]"]
  node_routine_logic["Routine interactions"]
  node_memories["Memory journal<br/>[memory.html]"]
  node_memory_logic["Memory interactions"]
  node_assessment["Cognitive assessment<br/>[assessment.html]"]
  node_assessment_logic["Assessment interactions<br/>[assessment.js]"]
end

subgraph group_care["Caregiver experience"]
  node_caregiver["Caregiver dashboard<br/>[caregiver.html]"]
  node_caregiver_logic["Care dashboard logic<br/>[caregiver.js]"]
end

subgraph group_backend["Backend services"]
  node_server["HTTP and socket server<br/>[server.js]"]
  node_memories_api["Memory routes<br/>[memories.js]"]
  node_routines_api["Routine routes<br/>[routines.js]"]
  node_assessment_api["Assessment routes<br/>[assessments.js]"]
  node_caregiver_api["Caregiver metrics<br/>[caregiver.js]"]
  node_db[("Care records store<br/>[db.js]")]
end

subgraph group_shared["Shared frontend"]
  node_home_controller["Home controller<br/>[main.js]"]
  node_login["Role login<br/>[login.html]"]
  node_local_data["Browser state<br/>[data.js]"]
  node_translations["Translations<br/>[translations.js]"]
  node_socket_client["Realtime client<br/>[socket-client.js]"]
end

node_patient_actor(("Patient"))
node_caregiver_actor(("Caregiver"))

node_patient_actor -->|"chooses role"| node_login
node_caregiver_actor -->|"chooses role"| node_login
node_patient_actor -->|"opens app"| node_home
node_patient_actor -->|"starts conversation"| node_companion
node_patient_actor -->|"manages reminders"| node_routines
node_patient_actor -->|"records memories"| node_memories
node_patient_actor -->|"completes check"| node_assessment
node_caregiver_actor -->|"reviews care"| node_caregiver
node_home -->|"loads controller"| node_home_controller
node_companion -->|"loads interactions"| node_companion_logic
node_routines -->|"loads interactions"| node_routine_logic
node_memories -->|"loads interactions"| node_memory_logic
node_assessment -->|"loads interactions"| node_assessment_logic
node_caregiver -->|"loads dashboard logic"| node_caregiver_logic
node_home_controller -->|"reads preferences"| node_local_data
node_home_controller -->|"uses translations"| node_translations
node_server -->|"dispatches requests"| node_memories_api
node_server -->|"dispatches requests"| node_routines_api
node_server -->|"dispatches requests"| node_assessment_api
node_server -->|"dispatches requests"| node_caregiver_api
node_memories_api -->|"reads and writes"| node_db
node_routines_api -->|"reads and writes"| node_db
node_assessment_api -->|"reads and writes"| node_db
node_caregiver_api -->|"reads records"| node_db
node_socket_client -->|"sends events"| node_server
node_server -->|"broadcasts alerts"| node_socket_client
node_caregiver_logic -->|"receives alerts"| node_socket_client

click node_home "https://github.com/harshat55/mindcare/blob/main/index.html"
click node_home_controller "https://github.com/harshat55/mindcare/blob/main/main.js"
click node_companion "https://github.com/harshat55/mindcare/blob/main/companion.html"
click node_companion_logic "https://github.com/harshat55/mindcare/blob/main/companion.js"
click node_routines "https://github.com/harshat55/mindcare/blob/main/routine.html"
click node_memories "https://github.com/harshat55/mindcare/blob/main/memory.html"
click node_assessment "https://github.com/harshat55/mindcare/blob/main/assessment.html"
click node_assessment_logic "https://github.com/harshat55/mindcare/blob/main/assessment.js"
click node_caregiver "https://github.com/harshat55/mindcare/blob/main/caregiver.html"
click node_caregiver_logic "https://github.com/harshat55/mindcare/blob/main/caregiver.js"
click node_login "https://github.com/harshat55/mindcare/blob/main/login.html"
click node_local_data "https://github.com/harshat55/mindcare/blob/main/data.js"
click node_translations "https://github.com/harshat55/mindcare/blob/main/translations.js"
click node_socket_client "https://github.com/harshat55/mindcare/blob/main/socket-client.js"
click node_server "https://github.com/harshat55/mindcare/blob/main/server.js"
click node_memories_api "https://github.com/harshat55/mindcare/blob/main/backend/routes/memories.js"
click node_routines_api "https://github.com/harshat55/mindcare/blob/main/backend/routes/routines.js"
click node_assessment_api "https://github.com/harshat55/mindcare/blob/main/backend/routes/assessments.js"
click node_caregiver_api "https://github.com/harshat55/mindcare/blob/main/backend/routes/caregiver.js"
click node_db "https://github.com/harshat55/mindcare/blob/main/backend/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_home,node_companion,node_companion_logic,node_routines,node_routine_logic,node_memories,node_memory_logic,node_assessment,node_assessment_logic toneBlue
class node_caregiver,node_caregiver_logic toneAmber
class node_server,node_memories_api,node_routines_api,node_assessment_api,node_caregiver_api,node_db toneMint
class node_home_controller,node_login,node_local_data,node_translations,node_socket_client toneRose
class node_patient_actor,node_caregiver_actor toneIndigo
```

## Components

### Patient experience

- [Home experience](https://github.com/harshat55/mindcare/blob/main/index.html): `index.html`
- [AI companion](https://github.com/harshat55/mindcare/blob/main/companion.html): `companion.html`
- [Companion interactions](https://github.com/harshat55/mindcare/blob/main/companion.js): `companion.js`
- [Daily routines](https://github.com/harshat55/mindcare/blob/main/routine.html): `routine.html`
- **Routine interactions**
- [Memory journal](https://github.com/harshat55/mindcare/blob/main/memory.html): `memory.html`
- **Memory interactions**
- [Cognitive assessment](https://github.com/harshat55/mindcare/blob/main/assessment.html): `assessment.html`
- [Assessment interactions](https://github.com/harshat55/mindcare/blob/main/assessment.js): `assessment.js`

### Caregiver experience

- [Caregiver dashboard](https://github.com/harshat55/mindcare/blob/main/caregiver.html): `caregiver.html`
- [Care dashboard logic](https://github.com/harshat55/mindcare/blob/main/caregiver.js): `caregiver.js`

### Backend services

- [HTTP and socket server](https://github.com/harshat55/mindcare/blob/main/server.js): `server.js`
- [Memory routes](https://github.com/harshat55/mindcare/blob/main/backend/routes/memories.js): `backend/routes/memories.js`
- [Routine routes](https://github.com/harshat55/mindcare/blob/main/backend/routes/routines.js): `backend/routes/routines.js`
- [Assessment routes](https://github.com/harshat55/mindcare/blob/main/backend/routes/assessments.js): `backend/routes/assessments.js`
- [Caregiver metrics](https://github.com/harshat55/mindcare/blob/main/backend/routes/caregiver.js): `backend/routes/caregiver.js`
- [Care records store](https://github.com/harshat55/mindcare/blob/main/backend/db.js): `backend/db.js`

### Shared frontend

- [Home controller](https://github.com/harshat55/mindcare/blob/main/main.js): `main.js`
- [Role login](https://github.com/harshat55/mindcare/blob/main/login.html): `login.html`
- [Browser state](https://github.com/harshat55/mindcare/blob/main/data.js): `data.js`
- [Translations](https://github.com/harshat55/mindcare/blob/main/translations.js): `translations.js`
- [Realtime client](https://github.com/harshat55/mindcare/blob/main/socket-client.js): `socket-client.js`

### Other components

- **Patient**
- **Caregiver**

## Connections

- Patient → Role login: chooses role
- Caregiver → Role login: chooses role
- Patient → Home experience: opens app
- Patient → AI companion: starts conversation
- Patient → Daily routines: manages reminders
- Patient → Memory journal: records memories
- Patient → Cognitive assessment: completes check
- Caregiver → Caregiver dashboard: reviews care
- Home experience → Home controller: loads controller
- AI companion → Companion interactions: loads interactions
- Daily routines → Routine interactions: loads interactions
- Memory journal → Memory interactions: loads interactions
- Cognitive assessment → Assessment interactions: loads interactions
- Caregiver dashboard → Care dashboard logic: loads dashboard logic
- Home controller → Browser state: reads preferences
- Home controller → Translations: uses translations
- HTTP and socket server → Memory routes: dispatches requests
- HTTP and socket server → Routine routes: dispatches requests
- HTTP and socket server → Assessment routes: dispatches requests
- HTTP and socket server → Caregiver metrics: dispatches requests
- Memory routes → Care records store: reads and writes
- Routine routes → Care records store: reads and writes
- Assessment routes → Care records store: reads and writes
- Caregiver metrics → Care records store: reads records
- Realtime client → HTTP and socket server: sends events
- HTTP and socket server → Realtime client: broadcasts alerts
- Care dashboard logic → Realtime client: receives alerts
