# yuno0997/elderly-app architecture

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

- Interactive diagram: https://gitdiagram.com/yuno0997/elderly-app
- Repository: https://github.com/yuno0997/elderly-app

## Overview

This is a facility-oriented elderly-care monitoring app: staff and relatives sign in, review resident status and live band vitals, respond to alerts, and manage residents, medications, devices, users, and reports. The React app routes role-aware screens through a shared authenticated API client to an Express backend; the backend owns endpoint handling and persists operational records in SQLite, with Firebase RTDB and SMS integrations. The graph preserves documented product areas, but several screen-to-endpoint details are unsampled and are shown only where excerpts or the README support the relationship.

Main entry points: [`server/index.js`](https://github.com/yuno0997/elderly-app/blob/main/server/index.js) (HTTP API), [`src/App.tsx`](https://github.com/yuno0997/elderly-app/blob/main/src/App.tsx) (App routing), [`src/lib/api.ts`](https://github.com/yuno0997/elderly-app/blob/main/src/lib/api.ts) (API client), [`src/components/Dashboard.tsx`](https://github.com/yuno0997/elderly-app/blob/main/src/components/Dashboard.tsx) (Monitoring dashboard)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web application"]
  node_app["App routing<br/>[App.tsx]"]
  node_auth["Sign in<br/>[Login.tsx]"]
  node_api_client["API client<br/>[api.ts]"]
end

subgraph group_care["Care workflows"]
  node_dashboard["Monitoring dashboard<br/>[Dashboard.tsx]"]
  node_residents["Resident management<br/>[Residents.tsx]"]
  node_resident_setup["Resident onboarding"]
  node_devices["Device management<br/>[Devices.tsx]"]
  node_medications["Medication tracking<br/>[MedicationLog.tsx]"]
  node_health_records["Health records<br/>[HealthRecords.tsx]"]
  node_resident_report["Resident reports<br/>[ResidentReport.tsx]"]
  node_alerts["Alert simulation"]
  node_users["User administration<br/>[Users.tsx]"]
  node_system["System management"]
  node_audit["Audit log<br/>[AuditLog.tsx]"]
end

subgraph group_service["Backend services"]
  node_api["HTTP API<br/>[index.js]"]
  node_db_module["Database setup<br/>[db.js]"]
end

subgraph group_data["Persistence and integrations"]
  node_sqlite[("Operational records")]
  node_firebase["Band data bridge<br/>[firebaseRtdb.js]"]
  node_sms["SMS delivery<br/>[unisms.js]"]
end

node_staff(("Staff or relative"))
node_rtdb[("Firebase RTDB")]
node_sms_service["SMS provider"]

node_staff -->|"uses"| node_app
node_app -->|"renders"| node_auth
node_app -->|"routes to"| node_dashboard
node_app -->|"routes to"| node_residents
node_app -->|"calls"| node_api_client
node_dashboard -->|"fetches"| node_api_client
node_residents -->|"updates"| node_api_client
node_residents -->|"opens"| node_resident_setup
node_api_client -->|"requests"| node_api
node_api -->|"initializes"| node_db_module
node_db_module -->|"opens"| node_sqlite
node_api -->|"reads band data"| node_firebase
node_firebase -->|"reads"| node_rtdb
node_api -->|"sends alerts"| node_sms
node_sms -.->|"delivers"| node_sms_service
node_dashboard -->|"loads vitals"| node_api
node_devices -->|"manages devices"| node_api
node_medications -->|"tracks doses"| node_api
node_health_records -.->|"loads records"| node_api
node_resident_report -->|"loads report data"| node_api
node_alerts -->|"tests alerts"| node_api
node_users -->|"manages users"| node_api
node_system -->|"configures system"| node_api
node_audit -->|"loads audit logs"| node_api

click node_app "https://github.com/yuno0997/elderly-app/blob/main/src/App.tsx"
click node_auth "https://github.com/yuno0997/elderly-app/blob/main/src/components/Login.tsx"
click node_api_client "https://github.com/yuno0997/elderly-app/blob/main/src/lib/api.ts"
click node_dashboard "https://github.com/yuno0997/elderly-app/blob/main/src/components/Dashboard.tsx"
click node_residents "https://github.com/yuno0997/elderly-app/blob/main/src/components/Residents.tsx"
click node_resident_setup "https://github.com/yuno0997/elderly-app/blob/main/src/components/ResidentWizardModal.tsx"
click node_devices "https://github.com/yuno0997/elderly-app/blob/main/src/components/Devices.tsx"
click node_medications "https://github.com/yuno0997/elderly-app/blob/main/src/components/MedicationLog.tsx"
click node_health_records "https://github.com/yuno0997/elderly-app/blob/main/src/components/HealthRecords.tsx"
click node_resident_report "https://github.com/yuno0997/elderly-app/blob/main/src/components/ResidentReport.tsx"
click node_alerts "https://github.com/yuno0997/elderly-app/blob/main/src/components/AlertSimulation.tsx"
click node_users "https://github.com/yuno0997/elderly-app/blob/main/src/components/Users.tsx"
click node_system "https://github.com/yuno0997/elderly-app/blob/main/src/components/SystemManagement.tsx"
click node_audit "https://github.com/yuno0997/elderly-app/blob/main/src/components/AuditLog.tsx"
click node_api "https://github.com/yuno0997/elderly-app/blob/main/server/index.js"
click node_db_module "https://github.com/yuno0997/elderly-app/blob/main/server/db.js"
click node_firebase "https://github.com/yuno0997/elderly-app/blob/main/server/firebaseRtdb.js"
click node_sms "https://github.com/yuno0997/elderly-app/blob/main/server/unisms.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_auth,node_api_client toneBlue
class node_dashboard,node_residents,node_resident_setup,node_devices,node_medications,node_health_records,node_resident_report,node_alerts,node_users,node_system,node_audit,node_rtdb toneAmber
class node_api,node_db_module toneMint
class node_sqlite,node_firebase,node_sms toneRose
class node_staff,node_sms_service toneIndigo
```

## Components

### Web application

- [App routing](https://github.com/yuno0997/elderly-app/blob/main/src/App.tsx): `src/App.tsx`
- [Sign in](https://github.com/yuno0997/elderly-app/blob/main/src/components/Login.tsx): `src/components/Login.tsx`
- [API client](https://github.com/yuno0997/elderly-app/blob/main/src/lib/api.ts): `src/lib/api.ts`

### Care workflows

- [Monitoring dashboard](https://github.com/yuno0997/elderly-app/blob/main/src/components/Dashboard.tsx): `src/components/Dashboard.tsx`
- [Resident management](https://github.com/yuno0997/elderly-app/blob/main/src/components/Residents.tsx): `src/components/Residents.tsx`
- [Resident onboarding](https://github.com/yuno0997/elderly-app/blob/main/src/components/ResidentWizardModal.tsx): `src/components/ResidentWizardModal.tsx`
- [Device management](https://github.com/yuno0997/elderly-app/blob/main/src/components/Devices.tsx): `src/components/Devices.tsx`
- [Medication tracking](https://github.com/yuno0997/elderly-app/blob/main/src/components/MedicationLog.tsx): `src/components/MedicationLog.tsx`
- [Health records](https://github.com/yuno0997/elderly-app/blob/main/src/components/HealthRecords.tsx): `src/components/HealthRecords.tsx`
- [Resident reports](https://github.com/yuno0997/elderly-app/blob/main/src/components/ResidentReport.tsx): `src/components/ResidentReport.tsx`
- [Alert simulation](https://github.com/yuno0997/elderly-app/blob/main/src/components/AlertSimulation.tsx): `src/components/AlertSimulation.tsx`
- [User administration](https://github.com/yuno0997/elderly-app/blob/main/src/components/Users.tsx): `src/components/Users.tsx`
- [System management](https://github.com/yuno0997/elderly-app/blob/main/src/components/SystemManagement.tsx): `src/components/SystemManagement.tsx`
- [Audit log](https://github.com/yuno0997/elderly-app/blob/main/src/components/AuditLog.tsx): `src/components/AuditLog.tsx`

### Backend services

- [HTTP API](https://github.com/yuno0997/elderly-app/blob/main/server/index.js): `server/index.js`
- [Database setup](https://github.com/yuno0997/elderly-app/blob/main/server/db.js): `server/db.js`

### Persistence and integrations

- **Operational records**
- [Band data bridge](https://github.com/yuno0997/elderly-app/blob/main/server/firebaseRtdb.js): `server/firebaseRtdb.js`
- [SMS delivery](https://github.com/yuno0997/elderly-app/blob/main/server/unisms.js): `server/unisms.js`

### Other components

- **Staff or relative**
- **Firebase RTDB**
- **SMS provider**

## Connections

- Staff or relative → App routing: uses
- App routing → Sign in: renders (evidence: `src/App.tsx`)
- App routing → Monitoring dashboard: routes to (evidence: `src/App.tsx`)
- App routing → Resident management: routes to (evidence: `src/App.tsx`)
- App routing → API client: calls (evidence: `src/App.tsx`)
- Monitoring dashboard → API client: fetches (evidence: `src/components/Dashboard.tsx`)
- Resident management → API client: updates (evidence: `src/components/Residents.tsx`)
- Resident management → Resident onboarding: opens (evidence: `src/components/Residents.tsx`)
- API client → HTTP API: requests
- HTTP API → Database setup: initializes (evidence: `server/index.js`)
- Database setup → Operational records: opens (evidence: `server/db.js`)
- HTTP API → Band data bridge: reads band data (evidence: `server/index.js`)
- Band data bridge → Firebase RTDB: reads
- HTTP API → SMS delivery: sends alerts (evidence: `server/index.js`)
- SMS delivery → SMS provider: delivers
- Monitoring dashboard → HTTP API: loads vitals
- Device management → HTTP API: manages devices
- Medication tracking → HTTP API: tracks doses
- Health records → HTTP API: loads records
- Resident reports → HTTP API: loads report data (evidence: `src/components/ResidentReport.tsx`)
- Alert simulation → HTTP API: tests alerts (evidence: `src/components/AlertSimulation.tsx`)
- User administration → HTTP API: manages users
- System management → HTTP API: configures system
- Audit log → HTTP API: loads audit logs
