# agevine/agevine architecture

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

- Interactive diagram: https://gitdiagram.com/agevine/agevine
- Repository: https://github.com/agevine/agevine

## Overview

Agevine is an eldercare monitoring platform: wearable, voice, and smart-home integrations push health events to an API gateway, which stores them in PostgreSQL for family-dashboard monitoring and alert management. The gateway source excerpt confirms webhook ingestion and database use; the README documents the broader SDK-to-gateway-to-dashboard architecture and capabilities. Some dashboard and SDK internals were not sampled, so those documented branches are shown without inferred internal call paths.

Main entry points: [`apps/api-gateway/src/index.ts`](https://github.com/agevine/agevine/blob/main/apps/api-gateway/src/index.ts) (API gateway), [`packages/wearables/src/index.ts`](https://github.com/agevine/agevine/blob/main/packages/wearables/src/index.ts) (Wearables SDK), [`packages/voice/src/index.ts`](https://github.com/agevine/agevine/blob/main/packages/voice/src/index.ts) (Voice SDK), [`packages/iot/src/index.ts`](https://github.com/agevine/agevine/blob/main/packages/iot/src/index.ts) (IoT SDK)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_integrations["Device Integrations"]
  node_wearables_sdk["Wearables SDK<br/>[index.ts]"]
  node_healthkit_ios["HealthKit adapter"]
  node_healthconnect_android["Health Connect adapter"]
  node_voice_sdk["Voice SDK<br/>[index.ts]"]
  node_iot_sdk["IoT SDK<br/>[index.ts]"]
end

subgraph group_gateway["API Gateway"]
  node_gateway_app["API gateway<br/>[index.ts]"]
end

subgraph group_storage["Health Data"]
  node_postgres[("PostgreSQL")]
  node_data_schema["Health data schema<br/>[schema.ts]"]
end

subgraph group_dashboard["Family Dashboard"]
  node_dashboard_home["Health dashboard<br/>[page.tsx]"]
  node_patient_management["Patient profiles<br/>[page.tsx]"]
  node_alert_management["Alert management<br/>[page.tsx]"]
  node_device_management["Device monitoring<br/>[page.tsx]"]
  node_voice_analysis["Voice sentiment trends<br/>[SentimentChart.tsx]"]
  node_voice_logs["Voice logs<br/>[page.tsx]"]
  node_settings["Account settings<br/>[page.tsx]"]
  node_auth_route["Dashboard authentication<br/>[route.ts]"]
end

node_family(("Family caregiver"))
node_wearable_devices(("Wearable devices"))
node_voice_platforms(("Voice AI platforms"))
node_smart_sensors(("Smart sensors"))

node_wearable_devices -->|"provides health data"| node_wearables_sdk
node_wearables_sdk -->|"pushes vitals"| node_gateway_app
node_healthkit_ios -.->|"adapts HealthKit"| node_wearables_sdk
node_healthconnect_android -.->|"adapts Health Connect"| node_wearables_sdk
node_voice_platforms -->|"provides call data"| node_voice_sdk
node_voice_sdk -->|"pushes call logs"| node_gateway_app
node_smart_sensors -->|"provides sensor events"| node_iot_sdk
node_iot_sdk -->|"pushes events"| node_gateway_app
node_gateway_app -->|"stores and queries"| node_postgres
node_gateway_app -->|"uses table definitions"| node_data_schema
node_family -->|"views health data"| node_dashboard_home
node_postgres -->|"supplies dashboard data"| node_dashboard_home
node_patient_management -->|"requests patient data"| node_gateway_app
node_alert_management -->|"manages alert rules"| node_gateway_app
node_family -->|"configures notifications"| node_alert_management
node_postgres -->|"supplies sentiment history"| node_voice_analysis
node_postgres -->|"supplies call history"| node_voice_logs
node_postgres -.->|"supplies device status"| node_device_management
node_family -.->|"manages account"| node_settings
node_family -->|"submits password"| node_auth_route

click node_wearables_sdk "https://github.com/agevine/agevine/blob/main/packages/wearables/src/index.ts"
click node_healthkit_ios "https://github.com/agevine/agevine/blob/main/packages/wearables/ios/AgevineHealthKit.swift"
click node_healthconnect_android "https://github.com/agevine/agevine/blob/main/packages/wearables/android/AgevineHealthConnect.kt"
click node_voice_sdk "https://github.com/agevine/agevine/blob/main/packages/voice/src/index.ts"
click node_iot_sdk "https://github.com/agevine/agevine/blob/main/packages/iot/src/index.ts"
click node_gateway_app "https://github.com/agevine/agevine/blob/main/apps/api-gateway/src/index.ts"
click node_data_schema "https://github.com/agevine/agevine/blob/main/apps/api-gateway/src/db/schema.ts"
click node_dashboard_home "https://github.com/agevine/agevine/blob/main/apps/ui-core/src/app/(main)/dashboard/page.tsx"
click node_patient_management "https://github.com/agevine/agevine/blob/main/apps/ui-core/src/app/(main)/patients/page.tsx"
click node_alert_management "https://github.com/agevine/agevine/blob/main/apps/ui-core/src/app/(main)/alerts/page.tsx"
click node_device_management "https://github.com/agevine/agevine/blob/main/apps/ui-core/src/app/(main)/devices/page.tsx"
click node_voice_analysis "https://github.com/agevine/agevine/blob/main/apps/ui-core/src/components/SentimentChart.tsx"
click node_voice_logs "https://github.com/agevine/agevine/blob/main/apps/ui-core/src/app/(main)/voice-logs/page.tsx"
click node_settings "https://github.com/agevine/agevine/blob/main/apps/ui-core/src/app/(main)/settings/page.tsx"
click node_auth_route "https://github.com/agevine/agevine/blob/main/apps/ui-core/src/app/api/auth/route.ts"

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_wearables_sdk,node_healthkit_ios,node_healthconnect_android,node_voice_sdk,node_iot_sdk toneBlue
class node_gateway_app toneAmber
class node_postgres,node_data_schema toneMint
class node_dashboard_home,node_patient_management,node_alert_management,node_device_management,node_voice_analysis,node_voice_logs,node_settings,node_auth_route toneRose
class node_family,node_wearable_devices,node_voice_platforms,node_smart_sensors toneIndigo
```

## Components

### Device Integrations

- [Wearables SDK](https://github.com/agevine/agevine/blob/main/packages/wearables/src/index.ts): `packages/wearables/src/index.ts`
- [HealthKit adapter](https://github.com/agevine/agevine/blob/main/packages/wearables/ios/AgevineHealthKit.swift): `packages/wearables/ios/AgevineHealthKit.swift`
- [Health Connect adapter](https://github.com/agevine/agevine/blob/main/packages/wearables/android/AgevineHealthConnect.kt): `packages/wearables/android/AgevineHealthConnect.kt`
- [Voice SDK](https://github.com/agevine/agevine/blob/main/packages/voice/src/index.ts): `packages/voice/src/index.ts`
- [IoT SDK](https://github.com/agevine/agevine/blob/main/packages/iot/src/index.ts): `packages/iot/src/index.ts`

### API Gateway

- [API gateway](https://github.com/agevine/agevine/blob/main/apps/api-gateway/src/index.ts): `apps/api-gateway/src/index.ts`

### Health Data

- **PostgreSQL**
- [Health data schema](https://github.com/agevine/agevine/blob/main/apps/api-gateway/src/db/schema.ts): `apps/api-gateway/src/db/schema.ts`

### Family Dashboard

- [Health dashboard](https://github.com/agevine/agevine/blob/main/apps/ui-core/src/app/(main)/dashboard/page.tsx): `apps/ui-core/src/app/(main)/dashboard/page.tsx`
- [Patient profiles](https://github.com/agevine/agevine/blob/main/apps/ui-core/src/app/(main)/patients/page.tsx): `apps/ui-core/src/app/(main)/patients/page.tsx`
- [Alert management](https://github.com/agevine/agevine/blob/main/apps/ui-core/src/app/(main)/alerts/page.tsx): `apps/ui-core/src/app/(main)/alerts/page.tsx`
- [Device monitoring](https://github.com/agevine/agevine/blob/main/apps/ui-core/src/app/(main)/devices/page.tsx): `apps/ui-core/src/app/(main)/devices/page.tsx`
- [Voice sentiment trends](https://github.com/agevine/agevine/blob/main/apps/ui-core/src/components/SentimentChart.tsx): `apps/ui-core/src/components/SentimentChart.tsx`
- [Voice logs](https://github.com/agevine/agevine/blob/main/apps/ui-core/src/app/(main)/voice-logs/page.tsx): `apps/ui-core/src/app/(main)/voice-logs/page.tsx`
- [Account settings](https://github.com/agevine/agevine/blob/main/apps/ui-core/src/app/(main)/settings/page.tsx): `apps/ui-core/src/app/(main)/settings/page.tsx`
- [Dashboard authentication](https://github.com/agevine/agevine/blob/main/apps/ui-core/src/app/api/auth/route.ts): `apps/ui-core/src/app/api/auth/route.ts`

### Other components

- **Family caregiver**
- **Wearable devices**
- **Voice AI platforms**
- **Smart sensors**

## Connections

- Wearable devices → Wearables SDK: provides health data (evidence: `README.md`)
- Wearables SDK → API gateway: pushes vitals (evidence: `README.md`)
- HealthKit adapter → Wearables SDK: adapts HealthKit
- Health Connect adapter → Wearables SDK: adapts Health Connect
- Voice AI platforms → Voice SDK: provides call data (evidence: `README.md`)
- Voice SDK → API gateway: pushes call logs (evidence: `README.md`)
- Smart sensors → IoT SDK: provides sensor events (evidence: `README.md`)
- IoT SDK → API gateway: pushes events (evidence: `README.md`)
- API gateway → PostgreSQL: stores and queries (evidence: `README.md`)
- API gateway → Health data schema: uses table definitions (evidence: `apps/api-gateway/src/index.ts`)
- Family caregiver → Health dashboard: views health data (evidence: `README.md`)
- PostgreSQL → Health dashboard: supplies dashboard data (evidence: `README.md`)
- Patient profiles → API gateway: requests patient data (evidence: `apps/ui-core/src/app/(main)/patients/page.tsx`)
- Alert management → API gateway: manages alert rules (evidence: `apps/ui-core/src/app/(main)/alerts/page.tsx`)
- Family caregiver → Alert management: configures notifications (evidence: `README.md`)
- PostgreSQL → Voice sentiment trends: supplies sentiment history (evidence: `README.md`)
- PostgreSQL → Voice logs: supplies call history (evidence: `README.md`)
- PostgreSQL → Device monitoring: supplies device status
- Family caregiver → Account settings: manages account
- Family caregiver → Dashboard authentication: submits password (evidence: `apps/ui-core/src/app/api/auth/route.ts`)
