# showri9/project-gesture architecture

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

- Interactive diagram: https://gitdiagram.com/showri9/project-gesture
- Repository: https://github.com/showri9/project-gesture

## Overview

gesturectl turns camera or phone-detected hand poses into TV commands. The main workflow captures frames, recognizes poses, applies configurable gesture bindings and session safeguards, then dispatches intents through device-specific adapters. The service path lets a browser send poses and control devices through the same backend session and adapter layer. README capabilities include device discovery and selection, pairing, configuration, status events, and Roku, Google TV, and Fire TV adapters. Some links are documented at a high level; unsampled implementation details are not inferred.

Main entry points: [`src/gesturectl/main.py`](https://github.com/showri9/project-gesture/blob/main/src/gesturectl/main.py) (Desktop runner), [`src/gesturectl/api/hub.py`](https://github.com/showri9/project-gesture/blob/main/src/gesturectl/api/hub.py) (Control hub), [`src/gesturectl/devices/base.py`](https://github.com/showri9/project-gesture/blob/main/src/gesturectl/devices/base.py) (Adapter interface), [`src/gesturectl/session.py`](https://github.com/showri9/project-gesture/blob/main/src/gesturectl/session.py) (Session machine)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_gesture["Gesture input"]
  node_desktop["Desktop runner<br/>[main.py]"]
  node_capture["Frame capture<br/>[capture.py]"]
  node_vision["Hand vision<br/>[vision.py]"]
  node_browser_detector["Browser detector<br/>[detector.js]"]
end

subgraph group_core["Portable control core"]
  node_classification["Pose classifier<br/>[classify.py]"]
  node_motion["Motion gestures<br/>[motion.py]"]
  node_config["Configuration<br/>[config.py]"]
  node_session["Session machine<br/>[session.py]"]
  node_intents["Intent contract<br/>[intents.py]"]
  node_hud["Status HUD<br/>[hud.py]"]
end

subgraph group_service["Service and browser"]
  node_server["HTTP server<br/>[server.py]"]
  node_routes["API routes<br/>[routes.py]"]
  node_hub["Control hub<br/>[hub.py]"]
  node_events["Event bus<br/>[events.py]"]
  node_web_app["Browser interface<br/>[app.js]"]
  node_api_client["Browser API client<br/>[client.js]"]
end

subgraph group_devices["Device control"]
  node_discovery["Device discovery<br/>[discover.py]"]
  node_adapter["Adapter interface<br/>[base.py]"]
  node_roku["Roku adapter<br/>[roku.py]"]
  node_google["Google TV adapter<br/>[googletv.py]"]
  node_fire["Fire TV adapter<br/>[firetv.py]"]
end

node_person(("User"))
node_camera(("Camera"))
node_phone(("Phone browser"))
node_tv(("TV device"))

node_person -->|"aims at"| node_camera
node_camera -->|"provides frames"| node_capture
node_desktop -->|"runs capture"| node_capture
node_desktop -->|"runs vision"| node_vision
node_vision -->|"classifies landmarks"| node_classification
node_classification -->|"feeds poses"| node_session
node_motion -->|"uses intents"| node_intents
node_desktop -->|"loads settings"| node_config
node_config -->|"configures"| node_session
node_session -->|"emits messages"| node_intents
node_desktop -->|"processes poses"| node_session
node_desktop -->|"updates display"| node_hud
node_desktop -->|"dispatches intents"| node_adapter
node_web_app -->|"uses detector"| node_browser_detector
node_web_app -->|"calls API"| node_api_client
node_person -->|"uses controls"| node_phone
node_phone -->|"opens interface"| node_web_app
node_browser_detector -->|"streams poses"| node_api_client
node_api_client -->|"calls endpoints"| node_routes
node_server -->|"mounts router"| node_routes
node_routes -->|"delegates requests"| node_hub
node_hub -->|"processes poses"| node_session
node_hub -->|"publishes updates"| node_events
node_hub -->|"scans devices"| node_discovery
node_hub -->|"manages adapters"| node_adapter
node_adapter -->|"implemented by"| node_roku
node_adapter -->|"implemented by"| node_google
node_adapter -->|"implemented by"| node_fire
node_roku -->|"sends commands"| node_tv
node_google -->|"sends commands"| node_tv
node_fire -->|"sends commands"| node_tv

click node_desktop "https://github.com/showri9/project-gesture/blob/main/src/gesturectl/main.py"
click node_capture "https://github.com/showri9/project-gesture/blob/main/src/gesturectl/capture.py"
click node_vision "https://github.com/showri9/project-gesture/blob/main/src/gesturectl/vision.py"
click node_browser_detector "https://github.com/showri9/project-gesture/blob/main/frontend/src/vision/detector.js"
click node_classification "https://github.com/showri9/project-gesture/blob/main/src/gesturectl/classify.py"
click node_motion "https://github.com/showri9/project-gesture/blob/main/src/gesturectl/motion.py"
click node_config "https://github.com/showri9/project-gesture/blob/main/src/gesturectl/config.py"
click node_session "https://github.com/showri9/project-gesture/blob/main/src/gesturectl/session.py"
click node_intents "https://github.com/showri9/project-gesture/blob/main/src/gesturectl/intents.py"
click node_hud "https://github.com/showri9/project-gesture/blob/main/src/gesturectl/hud.py"
click node_server "https://github.com/showri9/project-gesture/blob/main/src/gesturectl/server.py"
click node_routes "https://github.com/showri9/project-gesture/blob/main/src/gesturectl/api/routes.py"
click node_hub "https://github.com/showri9/project-gesture/blob/main/src/gesturectl/api/hub.py"
click node_events "https://github.com/showri9/project-gesture/blob/main/src/gesturectl/api/events.py"
click node_web_app "https://github.com/showri9/project-gesture/blob/main/frontend/src/app.js"
click node_api_client "https://github.com/showri9/project-gesture/blob/main/frontend/src/api/client.js"
click node_discovery "https://github.com/showri9/project-gesture/blob/main/src/gesturectl/devices/discover.py"
click node_adapter "https://github.com/showri9/project-gesture/blob/main/src/gesturectl/devices/base.py"
click node_roku "https://github.com/showri9/project-gesture/blob/main/src/gesturectl/devices/roku.py"
click node_google "https://github.com/showri9/project-gesture/blob/main/src/gesturectl/devices/googletv.py"
click node_fire "https://github.com/showri9/project-gesture/blob/main/src/gesturectl/devices/firetv.py"

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_desktop,node_capture,node_vision,node_browser_detector,node_person,node_phone toneBlue
class node_classification,node_motion,node_config,node_session,node_intents,node_hud toneAmber
class node_server,node_routes,node_hub,node_events,node_web_app,node_api_client toneMint
class node_discovery,node_adapter,node_roku,node_google,node_fire toneRose
class node_camera,node_tv toneIndigo
```

## Components

### Gesture input

- [Desktop runner](https://github.com/showri9/project-gesture/blob/main/src/gesturectl/main.py): `src/gesturectl/main.py`
- [Frame capture](https://github.com/showri9/project-gesture/blob/main/src/gesturectl/capture.py): `src/gesturectl/capture.py`
- [Hand vision](https://github.com/showri9/project-gesture/blob/main/src/gesturectl/vision.py): `src/gesturectl/vision.py`
- [Browser detector](https://github.com/showri9/project-gesture/blob/main/frontend/src/vision/detector.js): `frontend/src/vision/detector.js`

### Portable control core

- [Pose classifier](https://github.com/showri9/project-gesture/blob/main/src/gesturectl/classify.py): `src/gesturectl/classify.py`
- [Motion gestures](https://github.com/showri9/project-gesture/blob/main/src/gesturectl/motion.py): `src/gesturectl/motion.py`
- [Configuration](https://github.com/showri9/project-gesture/blob/main/src/gesturectl/config.py): `src/gesturectl/config.py`
- [Session machine](https://github.com/showri9/project-gesture/blob/main/src/gesturectl/session.py): `src/gesturectl/session.py`
- [Intent contract](https://github.com/showri9/project-gesture/blob/main/src/gesturectl/intents.py): `src/gesturectl/intents.py`
- [Status HUD](https://github.com/showri9/project-gesture/blob/main/src/gesturectl/hud.py): `src/gesturectl/hud.py`

### Service and browser

- [HTTP server](https://github.com/showri9/project-gesture/blob/main/src/gesturectl/server.py): `src/gesturectl/server.py`
- [API routes](https://github.com/showri9/project-gesture/blob/main/src/gesturectl/api/routes.py): `src/gesturectl/api/routes.py`
- [Control hub](https://github.com/showri9/project-gesture/blob/main/src/gesturectl/api/hub.py): `src/gesturectl/api/hub.py`
- [Event bus](https://github.com/showri9/project-gesture/blob/main/src/gesturectl/api/events.py): `src/gesturectl/api/events.py`
- [Browser interface](https://github.com/showri9/project-gesture/blob/main/frontend/src/app.js): `frontend/src/app.js`
- [Browser API client](https://github.com/showri9/project-gesture/blob/main/frontend/src/api/client.js): `frontend/src/api/client.js`

### Device control

- [Device discovery](https://github.com/showri9/project-gesture/blob/main/src/gesturectl/devices/discover.py): `src/gesturectl/devices/discover.py`
- [Adapter interface](https://github.com/showri9/project-gesture/blob/main/src/gesturectl/devices/base.py): `src/gesturectl/devices/base.py`
- [Roku adapter](https://github.com/showri9/project-gesture/blob/main/src/gesturectl/devices/roku.py): `src/gesturectl/devices/roku.py`
- [Google TV adapter](https://github.com/showri9/project-gesture/blob/main/src/gesturectl/devices/googletv.py): `src/gesturectl/devices/googletv.py`
- [Fire TV adapter](https://github.com/showri9/project-gesture/blob/main/src/gesturectl/devices/firetv.py): `src/gesturectl/devices/firetv.py`

### Other components

- **User**
- **Camera**
- **Phone browser**
- **TV device**

## Connections

- User → Camera: aims at (evidence: `README.md`)
- Camera → Frame capture: provides frames (evidence: `README.md`)
- Desktop runner → Frame capture: runs capture (evidence: `src/gesturectl/main.py`)
- Desktop runner → Hand vision: runs vision (evidence: `src/gesturectl/main.py`)
- Hand vision → Pose classifier: classifies landmarks (evidence: `src/gesturectl/vision.py`)
- Pose classifier → Session machine: feeds poses (evidence: `README.md`)
- Motion gestures → Intent contract: uses intents (evidence: `src/gesturectl/motion.py`)
- Desktop runner → Configuration: loads settings (evidence: `src/gesturectl/main.py`)
- Configuration → Session machine: configures (evidence: `src/gesturectl/config.py`)
- Session machine → Intent contract: emits messages (evidence: `src/gesturectl/session.py`)
- Desktop runner → Session machine: processes poses (evidence: `README.md`)
- Desktop runner → Status HUD: updates display (evidence: `src/gesturectl/main.py`)
- Desktop runner → Adapter interface: dispatches intents (evidence: `README.md`)
- Browser interface → Browser detector: uses detector (evidence: `frontend/src/app.js`)
- Browser interface → Browser API client: calls API (evidence: `frontend/src/app.js`)
- User → Phone browser: uses controls (evidence: `README.md`)
- Phone browser → Browser interface: opens interface (evidence: `README.md`)
- Browser detector → Browser API client: streams poses (evidence: `frontend/src/app.js`)
- Browser API client → API routes: calls endpoints (evidence: `frontend/src/api/client.js`)
- HTTP server → API routes: mounts router
- API routes → Control hub: delegates requests (evidence: `src/gesturectl/api/routes.py`)
- Control hub → Session machine: processes poses (evidence: `src/gesturectl/api/hub.py`)
- Control hub → Event bus: publishes updates (evidence: `src/gesturectl/api/hub.py`)
- Control hub → Device discovery: scans devices (evidence: `src/gesturectl/api/hub.py`)
- Control hub → Adapter interface: manages adapters (evidence: `src/gesturectl/api/hub.py`)
- Adapter interface → Roku adapter: implemented by (evidence: `src/gesturectl/devices/roku.py`)
- Adapter interface → Google TV adapter: implemented by (evidence: `src/gesturectl/devices/googletv.py`)
- Adapter interface → Fire TV adapter: implemented by (evidence: `src/gesturectl/devices/firetv.py`)
- Roku adapter → TV device: sends commands (evidence: `src/gesturectl/devices/roku.py`)
- Google TV adapter → TV device: sends commands (evidence: `README.md`)
- Fire TV adapter → TV device: sends commands (evidence: `README.md`)
