# mhdd4nish/kinetica architecture

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

- Interactive diagram: https://gitdiagram.com/mhdd4nish/kinetica
- Repository: https://github.com/mhdd4nish/kinetica

## Overview

Kinetica is a camera-based motor-skill game for children. Its main workflow streams webcam video from the browser through a Node/Mediasoup server to a Python pose-processing engine, then returns live actions to the React game for feedback and progress tracking. Completed sessions and parent PINs use a separate FastAPI service backed by SQLite. The README documents the cross-process media and data flows; some internal implementation details were not excerpted, so the graph avoids asserting unshown calls.

Main entry points: [`client/src/App.jsx`](https://github.com/mhdd4nish/kinetica/blob/main/client/src/App.jsx) (Game application), [`api_service/app/main.py`](https://github.com/mhdd4nish/kinetica/blob/main/api_service/app/main.py) (FastAPI service), [`server/server.js`](https://github.com/mhdd4nish/kinetica/blob/main/server/server.js) (Mediasoup server), [`client/src/hooks/useMediasoup.js`](https://github.com/mhdd4nish/kinetica/blob/main/client/src/hooks/useMediasoup.js) (WebRTC client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Game client"]
  node_react_app["Game application<br/>[App.jsx]"]
  node_catalog["Activity catalog"]
  node_activity_data["Activity definitions<br/>[activities.js]"]
  node_instructions["Activity instructions"]
  node_controls["Camera controls<br/>[Controls.jsx]"]
  node_pose_view["Pose overlay<br/>[PoseCanvas.jsx]"]
  node_game_overlay["Game feedback<br/>[GameOverlay.jsx]"]
  node_status["Connection status<br/>[StatusBar.jsx]"]
  node_targets["Activity targets<br/>[activityTargets.js]"]
  node_dashboard["Parent dashboard"]
end

subgraph group_realtime["Media transport"]
  node_media_hook["WebRTC client<br/>[useMediasoup.js]"]
  node_node_server["Mediasoup server<br/>[server.js]"]
  node_media_config["Media configuration<br/>[config.js]"]
end

subgraph group_vision["Pose processing"]
  node_rtp_parser["RTP parsing<br/>[processor.py]"]
  node_vp8_decoder["VP8 reassembly<br/>[processor.py]"]
  node_pose_estimator["Pose estimation<br/>[processor.py]"]
  node_action_classifier["Action classifier<br/>[processor.py]"]
end

subgraph group_persistence["Durable data"]
  node_api_client["Data API client<br/>[database.js]"]
  node_api_service["FastAPI service<br/>[main.py]"]
  node_api_models["Data models<br/>[models.py]"]
  node_api_schemas["Request schemas<br/>[schemas.py]"]
  node_api_security["PIN security<br/>[security.py]"]
  node_database[("SQLite database<br/>[database.py]")]
end

node_child(("Child"))

node_child -->|"chooses activity"| node_react_app
node_react_app -->|"renders"| node_catalog
node_catalog -->|"reads activities"| node_activity_data
node_react_app -->|"renders"| node_instructions
node_instructions -->|"reads activity"| node_activity_data
node_react_app -->|"renders"| node_controls
node_react_app -->|"renders"| node_status
node_react_app -->|"renders pose"| node_pose_view
node_react_app -->|"renders feedback"| node_game_overlay
node_react_app -->|"gets target"| node_targets
node_game_overlay -->|"reads targets"| node_targets
node_react_app -->|"renders"| node_dashboard
node_controls -->|"starts camera"| node_media_hook
node_react_app -->|"uses connection"| node_media_hook
node_media_hook -->|"signals WebRTC"| node_node_server
node_node_server -->|"loads settings"| node_media_config
node_node_server -->|"forwards raw RTP"| node_rtp_parser
node_rtp_parser -->|"parses packets"| node_vp8_decoder
node_vp8_decoder -->|"decodes frames"| node_pose_estimator
node_pose_estimator -->|"supplies landmarks"| node_action_classifier
node_action_classifier -->|"sends pose data"| node_node_server
node_node_server -->|"returns pose data"| node_media_hook
node_media_hook -->|"updates pose"| node_react_app
node_react_app -->|"saves session"| node_api_client
node_dashboard -->|"loads history and PIN"| node_api_client
node_api_client -->|"HTTP requests"| node_api_service
node_api_service -->|"queries records"| node_api_models
node_api_service -->|"validates responses"| node_api_schemas
node_api_service -->|"hashes and verifies PIN"| node_api_security
node_api_service -->|"opens request session"| node_database
node_api_models -->|"uses declarative base"| node_database

click node_react_app "https://github.com/mhdd4nish/kinetica/blob/main/client/src/App.jsx"
click node_catalog "https://github.com/mhdd4nish/kinetica/blob/main/client/src/components/ActivityCatalog.jsx"
click node_activity_data "https://github.com/mhdd4nish/kinetica/blob/main/client/src/data/activities.js"
click node_instructions "https://github.com/mhdd4nish/kinetica/blob/main/client/src/components/InstructionsScreen.jsx"
click node_controls "https://github.com/mhdd4nish/kinetica/blob/main/client/src/components/Controls.jsx"
click node_pose_view "https://github.com/mhdd4nish/kinetica/blob/main/client/src/components/PoseCanvas.jsx"
click node_game_overlay "https://github.com/mhdd4nish/kinetica/blob/main/client/src/components/GameOverlay.jsx"
click node_status "https://github.com/mhdd4nish/kinetica/blob/main/client/src/components/StatusBar.jsx"
click node_targets "https://github.com/mhdd4nish/kinetica/blob/main/client/src/config/activityTargets.js"
click node_dashboard "https://github.com/mhdd4nish/kinetica/blob/main/client/src/components/ParentDashboard.jsx"
click node_media_hook "https://github.com/mhdd4nish/kinetica/blob/main/client/src/hooks/useMediasoup.js"
click node_node_server "https://github.com/mhdd4nish/kinetica/blob/main/server/server.js"
click node_media_config "https://github.com/mhdd4nish/kinetica/blob/main/server/config.js"
click node_rtp_parser "https://github.com/mhdd4nish/kinetica/blob/main/python_engine/processor.py"
click node_vp8_decoder "https://github.com/mhdd4nish/kinetica/blob/main/python_engine/processor.py"
click node_pose_estimator "https://github.com/mhdd4nish/kinetica/blob/main/python_engine/processor.py"
click node_action_classifier "https://github.com/mhdd4nish/kinetica/blob/main/python_engine/processor.py"
click node_api_client "https://github.com/mhdd4nish/kinetica/blob/main/client/src/services/database.js"
click node_api_service "https://github.com/mhdd4nish/kinetica/blob/main/api_service/app/main.py"
click node_api_models "https://github.com/mhdd4nish/kinetica/blob/main/api_service/app/models.py"
click node_api_schemas "https://github.com/mhdd4nish/kinetica/blob/main/api_service/app/schemas.py"
click node_api_security "https://github.com/mhdd4nish/kinetica/blob/main/api_service/app/security.py"
click node_database "https://github.com/mhdd4nish/kinetica/blob/main/api_service/app/database.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_react_app,node_catalog,node_activity_data,node_instructions,node_controls,node_pose_view,node_game_overlay,node_status,node_targets,node_dashboard toneBlue
class node_media_hook,node_node_server,node_media_config toneAmber
class node_rtp_parser,node_vp8_decoder,node_pose_estimator,node_action_classifier toneMint
class node_api_client,node_api_service,node_api_models,node_api_schemas,node_api_security,node_database toneRose
class node_child toneIndigo
```

## Components

### Game client

- [Game application](https://github.com/mhdd4nish/kinetica/blob/main/client/src/App.jsx): `client/src/App.jsx`
- [Activity catalog](https://github.com/mhdd4nish/kinetica/blob/main/client/src/components/ActivityCatalog.jsx): `client/src/components/ActivityCatalog.jsx`
- [Activity definitions](https://github.com/mhdd4nish/kinetica/blob/main/client/src/data/activities.js): `client/src/data/activities.js`
- [Activity instructions](https://github.com/mhdd4nish/kinetica/blob/main/client/src/components/InstructionsScreen.jsx): `client/src/components/InstructionsScreen.jsx`
- [Camera controls](https://github.com/mhdd4nish/kinetica/blob/main/client/src/components/Controls.jsx): `client/src/components/Controls.jsx`
- [Pose overlay](https://github.com/mhdd4nish/kinetica/blob/main/client/src/components/PoseCanvas.jsx): `client/src/components/PoseCanvas.jsx`
- [Game feedback](https://github.com/mhdd4nish/kinetica/blob/main/client/src/components/GameOverlay.jsx): `client/src/components/GameOverlay.jsx`
- [Connection status](https://github.com/mhdd4nish/kinetica/blob/main/client/src/components/StatusBar.jsx): `client/src/components/StatusBar.jsx`
- [Activity targets](https://github.com/mhdd4nish/kinetica/blob/main/client/src/config/activityTargets.js): `client/src/config/activityTargets.js`
- [Parent dashboard](https://github.com/mhdd4nish/kinetica/blob/main/client/src/components/ParentDashboard.jsx): `client/src/components/ParentDashboard.jsx`

### Media transport

- [WebRTC client](https://github.com/mhdd4nish/kinetica/blob/main/client/src/hooks/useMediasoup.js): `client/src/hooks/useMediasoup.js`
- [Mediasoup server](https://github.com/mhdd4nish/kinetica/blob/main/server/server.js): `server/server.js`
- [Media configuration](https://github.com/mhdd4nish/kinetica/blob/main/server/config.js): `server/config.js`

### Pose processing

- [RTP parsing](https://github.com/mhdd4nish/kinetica/blob/main/python_engine/processor.py): `python_engine/processor.py`
- [VP8 reassembly](https://github.com/mhdd4nish/kinetica/blob/main/python_engine/processor.py): `python_engine/processor.py`
- [Pose estimation](https://github.com/mhdd4nish/kinetica/blob/main/python_engine/processor.py): `python_engine/processor.py`
- [Action classifier](https://github.com/mhdd4nish/kinetica/blob/main/python_engine/processor.py): `python_engine/processor.py`

### Durable data

- [Data API client](https://github.com/mhdd4nish/kinetica/blob/main/client/src/services/database.js): `client/src/services/database.js`
- [FastAPI service](https://github.com/mhdd4nish/kinetica/blob/main/api_service/app/main.py): `api_service/app/main.py`
- [Data models](https://github.com/mhdd4nish/kinetica/blob/main/api_service/app/models.py): `api_service/app/models.py`
- [Request schemas](https://github.com/mhdd4nish/kinetica/blob/main/api_service/app/schemas.py): `api_service/app/schemas.py`
- [PIN security](https://github.com/mhdd4nish/kinetica/blob/main/api_service/app/security.py): `api_service/app/security.py`
- [SQLite database](https://github.com/mhdd4nish/kinetica/blob/main/api_service/app/database.py): `api_service/app/database.py`

### Other components

- **Child**

## Connections

- Child → Game application: chooses activity (evidence: `README.md`)
- Game application → Activity catalog: renders (evidence: `client/src/App.jsx`)
- Activity catalog → Activity definitions: reads activities (evidence: `client/src/components/ActivityCatalog.jsx`)
- Game application → Activity instructions: renders (evidence: `client/src/App.jsx`)
- Activity instructions → Activity definitions: reads activity (evidence: `client/src/components/InstructionsScreen.jsx`)
- Game application → Camera controls: renders (evidence: `client/src/App.jsx`)
- Game application → Connection status: renders (evidence: `client/src/App.jsx`)
- Game application → Pose overlay: renders pose (evidence: `client/src/App.jsx`)
- Game application → Game feedback: renders feedback (evidence: `client/src/App.jsx`)
- Game application → Activity targets: gets target (evidence: `client/src/App.jsx`)
- Game feedback → Activity targets: reads targets (evidence: `client/src/components/GameOverlay.jsx`)
- Game application → Parent dashboard: renders (evidence: `client/src/App.jsx`)
- Camera controls → WebRTC client: starts camera (evidence: `README.md`)
- Game application → WebRTC client: uses connection (evidence: `client/src/App.jsx`)
- WebRTC client → Mediasoup server: signals WebRTC (evidence: `README.md`)
- Mediasoup server → Media configuration: loads settings (evidence: `server/server.js`)
- Mediasoup server → RTP parsing: forwards raw RTP (evidence: `README.md`)
- RTP parsing → VP8 reassembly: parses packets (evidence: `README.md`)
- VP8 reassembly → Pose estimation: decodes frames (evidence: `README.md`)
- Pose estimation → Action classifier: supplies landmarks (evidence: `README.md`)
- Action classifier → Mediasoup server: sends pose data (evidence: `README.md`)
- Mediasoup server → WebRTC client: returns pose data (evidence: `README.md`)
- WebRTC client → Game application: updates pose (evidence: `client/src/App.jsx`)
- Game application → Data API client: saves session (evidence: `client/src/App.jsx`)
- Parent dashboard → Data API client: loads history and PIN (evidence: `client/src/components/ParentDashboard.jsx`)
- Data API client → FastAPI service: HTTP requests (evidence: `client/src/services/database.js`)
- FastAPI service → Data models: queries records (evidence: `api_service/app/main.py`)
- FastAPI service → Request schemas: validates responses (evidence: `api_service/app/main.py`)
- FastAPI service → PIN security: hashes and verifies PIN (evidence: `api_service/app/main.py`)
- FastAPI service → SQLite database: opens request session (evidence: `api_service/app/main.py`)
- Data models → SQLite database: uses declarative base (evidence: `api_service/app/models.py`)
