# idolahav/draco-dashboard-demo architecture

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

- Interactive diagram: https://gitdiagram.com/idolahav/draco-dashboard-demo
- Repository: https://github.com/idolahav/draco-dashboard-demo

## Overview

This is a first-activation demo spanning a browser client, an Express API, SQLite persistence, and an Android TV client. The main workflow is: a phone establishes a stable identity and submits an activation; the server validates and stores it once; a broadcaster sends live updates to an authenticated dashboard, which also supports login, reset, and QR-code activation. The README documents Android boot-triggered background activation and an interactive status screen. Server/client edges are supported by excerpts or the source index; Android relationships rely on README descriptions, as its source was not sampled.

Main entry points: [`server/src/app.ts`](https://github.com/idolahav/draco-dashboard-demo/blob/main/server/src/app.ts) (HTTP API), [`client/src/DashboardPage.tsx`](https://github.com/idolahav/draco-dashboard-demo/blob/main/client/src/DashboardPage.tsx) (Live dashboard), [`client/src/api.ts`](https://github.com/idolahav/draco-dashboard-demo/blob/main/client/src/api.ts) (Browser API calls), [`server/src/index.ts`](https://github.com/idolahav/draco-dashboard-demo/blob/main/server/src/index.ts) (Server startup)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Browser clients"]
  node_web_entry["Page routing<br/>[main.tsx]"]
  node_activate_page["Activate page<br/>[ActivatePage.tsx]"]
  node_web_identity["Web device identity<br/>[device.ts]"]
  node_web_api["Browser API calls<br/>[api.ts]"]
  node_dashboard["Live dashboard<br/>[DashboardPage.tsx]"]
  node_live_stream["Stream state<br/>[liveActivations.ts]"]
  node_time_display["Time display<br/>[time.ts]"]
end

subgraph group_server["Server runtime"]
  node_api_server["HTTP API<br/>[app.ts]"]
  node_server_config["Runtime config<br/>[config.ts]"]
  node_server_start["Server startup<br/>[index.ts]"]
  node_activation_repo["Activation repository<br/>[db.ts]"]
  node_sqlite[("SQLite activations")]
  node_broadcaster["SSE broadcaster<br/>[sse.ts]"]
end

subgraph group_shared["Shared contract"]
  node_contract["Activation contract<br/>[activation.ts]"]
end

subgraph group_android["Android client"]
  node_boot_receiver["Boot receiver<br/>[BootReceiver.kt]"]
  node_android_activation["Activation scheduling<br/>[Activation.kt]"]
  node_android_identity["Android identity<br/>[DeviceIdentity.kt]"]
  node_android_worker["Background worker"]
  node_android_protocol["Activation protocol"]
  node_android_screen["Status screen<br/>[MainActivity.kt]"]
end

node_phone(("Phone user"))

node_phone -->|"opens"| node_activate_page
node_web_entry -->|"routes to"| node_activate_page
node_web_entry -->|"routes to"| node_dashboard
node_activate_page -->|"uses identity"| node_web_identity
node_activate_page -->|"submits activation"| node_web_api
node_dashboard -->|"uses API"| node_web_api
node_dashboard -->|"uses stream"| node_live_stream
node_dashboard -->|"formats device"| node_web_identity
node_dashboard -->|"formats time"| node_time_display
node_web_api -->|"HTTP requests"| node_api_server
node_web_api -->|"uses types"| node_contract
node_live_stream -->|"opens stream"| node_api_server
node_live_stream -->|"checks session"| node_web_api
node_live_stream -->|"handles events"| node_contract
node_server_start -->|"loads config"| node_server_config
node_server_start -->|"creates repository"| node_activation_repo
node_server_start -->|"creates broadcaster"| node_broadcaster
node_server_start -->|"starts app"| node_api_server
node_api_server -->|"reads and writes"| node_activation_repo
node_api_server -->|"broadcasts events"| node_broadcaster
node_api_server -->|"uses settings"| node_server_config
node_api_server -->|"validates and names"| node_contract
node_activation_repo -->|"queries"| node_sqlite
node_broadcaster -->|"uses event names"| node_contract
node_boot_receiver -->|"schedules activation"| node_android_activation
node_android_activation -->|"schedules worker"| node_android_worker
node_android_worker -->|"posts protocol"| node_android_protocol
node_android_worker -->|"POSTs activation"| node_api_server
node_android_screen -->|"activates now"| node_android_activation
node_android_activation -->|"uses identity"| node_android_identity

click node_web_entry "https://github.com/idolahav/draco-dashboard-demo/blob/main/client/src/main.tsx"
click node_activate_page "https://github.com/idolahav/draco-dashboard-demo/blob/main/client/src/ActivatePage.tsx"
click node_web_identity "https://github.com/idolahav/draco-dashboard-demo/blob/main/client/src/device.ts"
click node_web_api "https://github.com/idolahav/draco-dashboard-demo/blob/main/client/src/api.ts"
click node_dashboard "https://github.com/idolahav/draco-dashboard-demo/blob/main/client/src/DashboardPage.tsx"
click node_live_stream "https://github.com/idolahav/draco-dashboard-demo/blob/main/client/src/liveActivations.ts"
click node_time_display "https://github.com/idolahav/draco-dashboard-demo/blob/main/client/src/time.ts"
click node_api_server "https://github.com/idolahav/draco-dashboard-demo/blob/main/server/src/app.ts"
click node_server_config "https://github.com/idolahav/draco-dashboard-demo/blob/main/server/src/config.ts"
click node_server_start "https://github.com/idolahav/draco-dashboard-demo/blob/main/server/src/index.ts"
click node_activation_repo "https://github.com/idolahav/draco-dashboard-demo/blob/main/server/src/db.ts"
click node_broadcaster "https://github.com/idolahav/draco-dashboard-demo/blob/main/server/src/sse.ts"
click node_contract "https://github.com/idolahav/draco-dashboard-demo/blob/main/shared/activation.ts"
click node_boot_receiver "https://github.com/idolahav/draco-dashboard-demo/blob/main/android/app/src/main/java/com/example/deviceactivation/BootReceiver.kt"
click node_android_activation "https://github.com/idolahav/draco-dashboard-demo/blob/main/android/app/src/main/java/com/example/deviceactivation/Activation.kt"
click node_android_identity "https://github.com/idolahav/draco-dashboard-demo/blob/main/android/app/src/main/java/com/example/deviceactivation/DeviceIdentity.kt"
click node_android_worker "https://github.com/idolahav/draco-dashboard-demo/blob/main/android/app/src/main/java/com/example/deviceactivation/ActivationWorker.kt"
click node_android_protocol "https://github.com/idolahav/draco-dashboard-demo/blob/main/android/app/src/main/java/com/example/deviceactivation/ActivationProtocol.kt"
click node_android_screen "https://github.com/idolahav/draco-dashboard-demo/blob/main/android/app/src/main/java/com/example/deviceactivation/MainActivity.kt"

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_web_entry,node_activate_page,node_web_identity,node_web_api,node_dashboard,node_live_stream,node_time_display,node_phone toneBlue
class node_api_server,node_server_config,node_server_start,node_activation_repo,node_sqlite,node_broadcaster toneAmber
class node_contract toneMint
class node_boot_receiver,node_android_activation,node_android_identity,node_android_worker,node_android_protocol,node_android_screen toneRose
```

## Components

### Browser clients

- [Page routing](https://github.com/idolahav/draco-dashboard-demo/blob/main/client/src/main.tsx): `client/src/main.tsx`
- [Activate page](https://github.com/idolahav/draco-dashboard-demo/blob/main/client/src/ActivatePage.tsx): `client/src/ActivatePage.tsx`
- [Web device identity](https://github.com/idolahav/draco-dashboard-demo/blob/main/client/src/device.ts): `client/src/device.ts`
- [Browser API calls](https://github.com/idolahav/draco-dashboard-demo/blob/main/client/src/api.ts): `client/src/api.ts`
- [Live dashboard](https://github.com/idolahav/draco-dashboard-demo/blob/main/client/src/DashboardPage.tsx): `client/src/DashboardPage.tsx`
- [Stream state](https://github.com/idolahav/draco-dashboard-demo/blob/main/client/src/liveActivations.ts): `client/src/liveActivations.ts`
- [Time display](https://github.com/idolahav/draco-dashboard-demo/blob/main/client/src/time.ts): `client/src/time.ts`

### Server runtime

- [HTTP API](https://github.com/idolahav/draco-dashboard-demo/blob/main/server/src/app.ts): `server/src/app.ts`
- [Runtime config](https://github.com/idolahav/draco-dashboard-demo/blob/main/server/src/config.ts): `server/src/config.ts`
- [Server startup](https://github.com/idolahav/draco-dashboard-demo/blob/main/server/src/index.ts): `server/src/index.ts`
- [Activation repository](https://github.com/idolahav/draco-dashboard-demo/blob/main/server/src/db.ts): `server/src/db.ts`
- **SQLite activations**
- [SSE broadcaster](https://github.com/idolahav/draco-dashboard-demo/blob/main/server/src/sse.ts): `server/src/sse.ts`

### Shared contract

- [Activation contract](https://github.com/idolahav/draco-dashboard-demo/blob/main/shared/activation.ts): `shared/activation.ts`

### Android client

- [Boot receiver](https://github.com/idolahav/draco-dashboard-demo/blob/main/android/app/src/main/java/com/example/deviceactivation/BootReceiver.kt): `android/app/src/main/java/com/example/deviceactivation/BootReceiver.kt`
- [Activation scheduling](https://github.com/idolahav/draco-dashboard-demo/blob/main/android/app/src/main/java/com/example/deviceactivation/Activation.kt): `android/app/src/main/java/com/example/deviceactivation/Activation.kt`
- [Android identity](https://github.com/idolahav/draco-dashboard-demo/blob/main/android/app/src/main/java/com/example/deviceactivation/DeviceIdentity.kt): `android/app/src/main/java/com/example/deviceactivation/DeviceIdentity.kt`
- [Background worker](https://github.com/idolahav/draco-dashboard-demo/blob/main/android/app/src/main/java/com/example/deviceactivation/ActivationWorker.kt): `android/app/src/main/java/com/example/deviceactivation/ActivationWorker.kt`
- [Activation protocol](https://github.com/idolahav/draco-dashboard-demo/blob/main/android/app/src/main/java/com/example/deviceactivation/ActivationProtocol.kt): `android/app/src/main/java/com/example/deviceactivation/ActivationProtocol.kt`
- [Status screen](https://github.com/idolahav/draco-dashboard-demo/blob/main/android/app/src/main/java/com/example/deviceactivation/MainActivity.kt): `android/app/src/main/java/com/example/deviceactivation/MainActivity.kt`

### Other components

- **Phone user**

## Connections

- Phone user → Activate page: opens (evidence: `README.md`)
- Page routing → Activate page: routes to (evidence: `client/src/main.tsx`)
- Page routing → Live dashboard: routes to (evidence: `client/src/main.tsx`)
- Activate page → Web device identity: uses identity (evidence: `client/src/ActivatePage.tsx`)
- Activate page → Browser API calls: submits activation (evidence: `client/src/ActivatePage.tsx`)
- Live dashboard → Browser API calls: uses API (evidence: `client/src/DashboardPage.tsx`)
- Live dashboard → Stream state: uses stream (evidence: `client/src/DashboardPage.tsx`)
- Live dashboard → Web device identity: formats device (evidence: `client/src/DashboardPage.tsx`)
- Live dashboard → Time display: formats time (evidence: `client/src/DashboardPage.tsx`)
- Browser API calls → HTTP API: HTTP requests (evidence: `README.md`)
- Browser API calls → Activation contract: uses types (evidence: `client/src/api.ts`)
- Stream state → HTTP API: opens stream (evidence: `client/src/liveActivations.ts`)
- Stream state → Browser API calls: checks session (evidence: `client/src/liveActivations.ts`)
- Stream state → Activation contract: handles events (evidence: `client/src/liveActivations.ts`)
- Server startup → Runtime config: loads config (evidence: `server/src/index.ts`)
- Server startup → Activation repository: creates repository (evidence: `server/src/index.ts`)
- Server startup → SSE broadcaster: creates broadcaster (evidence: `server/src/index.ts`)
- Server startup → HTTP API: starts app (evidence: `server/src/index.ts`)
- HTTP API → Activation repository: reads and writes (evidence: `server/src/app.ts`)
- HTTP API → SSE broadcaster: broadcasts events (evidence: `server/src/app.ts`)
- HTTP API → Runtime config: uses settings (evidence: `server/src/app.ts`)
- HTTP API → Activation contract: validates and names (evidence: `server/src/app.ts`)
- Activation repository → SQLite activations: queries (evidence: `server/src/db.ts`)
- SSE broadcaster → Activation contract: uses event names (evidence: `server/src/sse.ts`)
- Boot receiver → Activation scheduling: schedules activation (evidence: `README.md`)
- Activation scheduling → Background worker: schedules worker (evidence: `README.md`)
- Background worker → Activation protocol: posts protocol (evidence: `README.md`)
- Background worker → HTTP API: POSTs activation (evidence: `README.md`)
- Status screen → Activation scheduling: activates now (evidence: `README.md`)
- Activation scheduling → Android identity: uses identity (evidence: `README.md`)
