# cadornajansen/glove-system architecture

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

- Interactive diagram: https://gitdiagram.com/cadornajansen/glove-system
- Repository: https://github.com/cadornajansen/glove-system

## Overview

#### Purpose and Topology
Glove System is a healthcare-IoT research prototype for stroke rehabilitation monitoring. An Arduino glove gathers flex, vital, and gesture signals; Bluetooth delivers them to a local Node.js process, which exposes WebSocket updates consumed by a Next.js dashboard. The browser UI is deployable to Vercel, but the hardware bridge remains local to the Bluetooth-connected machine.

#### Application Entry and Routing
The Next.js App Router starts at `app/layout.tsx` and `app/page.tsx`. The primary live-monitor/dashboard experience is represented by `app/dashboard/page.tsx`; the product also presents healthcare workflow sections through route pages including `app/analytics/page.tsx`, `app/calendar/page.tsx`, and `app/care-plants/page.tsx`.

#### Hardware Ingestion and Bridge
`glove-bridge/bridge.js` is the boundary between physical hardware and the web system. It receives Bluetooth/serial-originated Arduino data, cleans/parses it into JSON, and forwards it over WebSocket. This process has its own Node runtime and dependency boundary in `glove-bridge/package.json`; it must run separately from the Next.js deployment and have access to the HC-05 Bluetooth connection.

#### Live Client Data Layer
`lib/use-glove-data.ts` is the browser-facing real-time integration point. Dashboard pages/components consume this hook’s live sensor/command state and connection status rather than directly handling hardware transport. This separates UI rendering from WebSocket lifecycle and payload interpretation.

#### Monitoring and Clinical UI Surfaces
The live dashboard is complemented by patient-facing information and operational views: `app/records/page.tsx`, `app/records/vitals/page.tsx`, `app/medication/today/page.tsx`, `app/tasks/page.tsx`, and report routes under `app/reports`. These appear to be dashboard UI workflow boundaries; no repository evidence establishes durable patient/history storage, so live and displayed data should be treated as client/UI-oriented unless a backend is added.

#### Shared Application Shell
`components/app-sidebar.tsx`, `components/page-shell.tsx`, and `components/sidebar.tsx` define the cross-route healthcare navigation and layout boundary. Navigation composition is split into `components/nav-main.tsx`, `components/nav-secondary.tsx`, and `components/nav-user.tsx`. Reusable shadcn-style controls under `components/ui/` keep route pages focused on monitoring/workflow composition.

#### API, Runtimes, and Deployment Boundaries
`app/api/vitals.ts` is the repository’s explicit Next-side vitals API surface. The web application uses Next.js/TypeScript and Tailwind/shadcn UI, configured from `package.json` and `next.config.ts`; Vercel is the documented web deployment target. Arduino Uno, flex sensors, MAX30102, LM35, and HC-05 Bluetooth are external physical dependencies. The local Node/WebSocket bridge is required for true live glove telemetry and cannot be replaced by the static hosted frontend alone.

Main entry points: [`app/layout.tsx`](https://github.com/cadornajansen/glove-system/blob/main/app/layout.tsx) (Application shell), [`glove-bridge/bridge.js`](https://github.com/cadornajansen/glove-system/blob/main/glove-bridge/bridge.js) (Telemetry bridge), [`app/dashboard/page.tsx`](https://github.com/cadornajansen/glove-system/blob/main/app/dashboard/page.tsx) (Live dashboard), [`app/records/page.tsx`](https://github.com/cadornajansen/glove-system/blob/main/app/records/page.tsx) (Clinical workflow routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_hardware["Rehab glove hardware"]
  node_arduino{{"Arduino glove<br/>embedded device"}}
  node_sensors["Sensors<br/>physical inputs"]
  node_hc05["HC-05 Bluetooth<br/>wireless transport"]
end

subgraph group_bridge["Local telemetry bridge"]
  node_bridge_runtime["Node bridge runtime<br/>local Node.js process<br/>[package.json]"]
  node_bridge{{"Telemetry bridge<br/>Bluetooth-to-WebSocket bridge<br/>[bridge.js]"}}
  node_websocket["WebSocket stream<br/>live telemetry channel"]
end

subgraph group_web["Next.js web application"]
  node_app_shell["Application shell<br/>Next.js layout<br/>[layout.tsx]"]
  node_home["Home route<br/>App Router page<br/>[page.tsx]"]
  node_live_hook{{"Glove data hook<br/>client real-time layer<br/>[use-glove-data.ts]"}}
  node_dashboard["Live dashboard<br/>monitoring route<br/>[page.tsx]"]
  node_clinical_workflows["Clinical workflow routes<br/>dashboard UI routes<br/>[page.tsx]"]
  node_vitals_api{{"Vitals API<br/>Next API surface<br/>[vitals.ts]"}}
  node_shared_navigation["Shared navigation<br/>layout components<br/>[app-sidebar.tsx]"]
  node_ui_controls["Reusable UI controls<br/>shadcn components<br/>[button.tsx]"]
end

node_vercel["Vercel deployment<br/>web hosting"]

node_sensors -->|"measurements"| node_arduino
node_arduino -->|"serial telemetry"| node_hc05
node_hc05 -->|"Bluetooth input"| node_bridge
node_bridge_runtime -->|"runs"| node_bridge
node_bridge -->|"JSON updates"| node_websocket
node_websocket -->|"live messages"| node_live_hook
node_live_hook -->|"sensor state"| node_dashboard
node_app_shell -->|"wraps"| node_home
node_app_shell -->|"wraps"| node_dashboard
node_app_shell -->|"wraps"| node_clinical_workflows
node_shared_navigation -->|"composes"| node_app_shell
node_ui_controls -.->|"supports"| node_dashboard
node_ui_controls -.->|"supports"| node_clinical_workflows
node_vitals_api -.->|"vitals surface"| node_clinical_workflows
node_vercel -->|"deploys web UI"| node_app_shell
node_vercel -.->|"does not host"| node_bridge

click node_bridge_runtime "https://github.com/cadornajansen/glove-system/blob/main/glove-bridge/package.json"
click node_bridge "https://github.com/cadornajansen/glove-system/blob/main/glove-bridge/bridge.js"
click node_app_shell "https://github.com/cadornajansen/glove-system/blob/main/app/layout.tsx"
click node_home "https://github.com/cadornajansen/glove-system/blob/main/app/page.tsx"
click node_live_hook "https://github.com/cadornajansen/glove-system/blob/main/lib/use-glove-data.ts"
click node_dashboard "https://github.com/cadornajansen/glove-system/blob/main/app/dashboard/page.tsx"
click node_clinical_workflows "https://github.com/cadornajansen/glove-system/blob/main/app/records/page.tsx"
click node_vitals_api "https://github.com/cadornajansen/glove-system/blob/main/app/api/vitals.ts"
click node_shared_navigation "https://github.com/cadornajansen/glove-system/blob/main/components/app-sidebar.tsx"
click node_ui_controls "https://github.com/cadornajansen/glove-system/blob/main/components/ui/button.tsx"

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_arduino,node_sensors,node_hc05 toneBlue
class node_bridge_runtime,node_bridge,node_websocket toneAmber
class node_app_shell,node_home,node_live_hook,node_dashboard,node_clinical_workflows,node_vitals_api,node_shared_navigation,node_ui_controls toneMint
class node_vercel toneNeutral
```

## Components

### Rehab glove hardware

Physical telemetry source.

- **Arduino glove**: embedded device · Collects flex, vital, and gesture signals.
- **Sensors**: physical inputs · Flex sensors, MAX30102, and LM35 feed the glove.
- **HC-05 Bluetooth**: wireless transport

### Local telemetry bridge

Must run on the Bluetooth-connected machine.

- [Node bridge runtime](https://github.com/cadornajansen/glove-system/blob/main/glove-bridge/package.json): local Node.js process · Separately deployed hardware integration runtime. · `glove-bridge/package.json`
- [Telemetry bridge](https://github.com/cadornajansen/glove-system/blob/main/glove-bridge/bridge.js): Bluetooth-to-WebSocket bridge · Cleans Arduino input into JSON and publishes live updates. · `glove-bridge/bridge.js`
- **WebSocket stream**: live telemetry channel

### Next.js web application

Dashboard and healthcare workflow UI.

- [Application shell](https://github.com/cadornajansen/glove-system/blob/main/app/layout.tsx): Next.js layout · Provides shared route structure. · `app/layout.tsx`
- [Home route](https://github.com/cadornajansen/glove-system/blob/main/app/page.tsx): App Router page · `app/page.tsx`
- [Glove data hook](https://github.com/cadornajansen/glove-system/blob/main/lib/use-glove-data.ts): client real-time layer · Owns WebSocket lifecycle, payload interpretation, and connection state. · `lib/use-glove-data.ts`
- [Live dashboard](https://github.com/cadornajansen/glove-system/blob/main/app/dashboard/page.tsx): monitoring route · Consumes live sensor and command state through the hook. · `app/dashboard/page.tsx`
- [Clinical workflow routes](https://github.com/cadornajansen/glove-system/blob/main/app/records/page.tsx): dashboard UI routes · Records, vitals, medication, tasks, reports, analytics, calendar, and care plans. · `app/records/page.tsx`
- [Vitals API](https://github.com/cadornajansen/glove-system/blob/main/app/api/vitals.ts): Next API surface · `app/api/vitals.ts`
- [Shared navigation](https://github.com/cadornajansen/glove-system/blob/main/components/app-sidebar.tsx): layout components · Healthcare sidebar and page-shell composition. · `components/app-sidebar.tsx`
- [Reusable UI controls](https://github.com/cadornajansen/glove-system/blob/main/components/ui/button.tsx): shadcn components · `components/ui/button.tsx`

### Other components

- **Vercel deployment**: web hosting · Hosts the frontend but not the Bluetooth bridge.

## Connections

- Sensors → Arduino glove: measurements
- Arduino glove → HC-05 Bluetooth: serial telemetry
- HC-05 Bluetooth → Telemetry bridge: Bluetooth input
- Node bridge runtime → Telemetry bridge: runs
- Telemetry bridge → WebSocket stream: JSON updates
- WebSocket stream → Glove data hook: live messages
- Glove data hook → Live dashboard: sensor state
- Application shell → Home route: wraps
- Application shell → Live dashboard: wraps
- Application shell → Clinical workflow routes: wraps
- Shared navigation → Application shell: composes
- Reusable UI controls → Live dashboard: supports
- Reusable UI controls → Clinical workflow routes: supports
- Vitals API → Clinical workflow routes: vitals surface
- Vercel deployment → Application shell: deploys web UI
- Vercel deployment → Telemetry bridge: does not host · Live telemetry still requires the local bridge.
