# sawyer1995nie-cpu/mingmirror-shadow-play architecture

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

- Interactive diagram: https://gitdiagram.com/sawyer1995nie-cpu/mingmirror-shadow-play
- Repository: https://github.com/sawyer1995nie-cpu/mingmirror-shadow-play

## Overview

MingMirror Shadow Play is a browser-local hand-gesture puppet experience. A visitor starts camera input or a simulated demo; landmarks are converted into gesture state and events, which drive the five-finger puppet rig on the shadow-play stage. The README documents this input-to-engine-to-scene separation and privacy behavior. Core gesture processing is represented at the detector, smoothing, and state-transition layers. Some UI and scene files were not sampled, so links beyond documented or indexed relationships are omitted rather than inferred.

Main entry points: [`src/gesture/GestureEngine.ts`](https://github.com/sawyer1995nie-cpu/mingmirror-shadow-play/blob/main/src/gesture/GestureEngine.ts) (Gesture Engine), [`src/components/GestureInput.tsx`](https://github.com/sawyer1995nie-cpu/mingmirror-shadow-play/blob/main/src/components/GestureInput.tsx) (Gesture Input), [`src/App.tsx`](https://github.com/sawyer1995nie-cpu/mingmirror-shadow-play/blob/main/src/App.tsx) (App Wiring), [`src/gesture/GestureDetector.ts`](https://github.com/sawyer1995nie-cpu/mingmirror-shadow-play/blob/main/src/gesture/GestureDetector.ts) (Gesture Detector)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Stage Experience"]
  node_app["App Wiring<br/>[App.tsx]"]
  node_playground["Shadow Stage"]
  node_puppet["Puppet Rig<br/>[ShadowPuppet.tsx]"]
end

subgraph group_input["Hand Input"]
  node_gesture_input["Gesture Input<br/>[GestureInput.tsx]"]
  node_hand_tracker["Hand Tracker<br/>[HandTracker.ts]"]
  node_demo_hands["Demo Hands<br/>[demoHands.ts]"]
end

subgraph group_engine["Gesture Engine"]
  node_engine["Gesture Engine<br/>[GestureEngine.ts]"]
  node_detector["Gesture Detector<br/>[GestureDetector.ts]"]
  node_state_machine["State Machine"]
  node_gesture_state["Gesture State<br/>[GestureState.ts]"]
end

subgraph group_support["Gesture Support"]
  node_smoother["Gesture Smoother<br/>[GestureSmoother.ts]"]
  node_recognizers["Gesture Recognizers"]
  node_math["Landmark Math<br/>[math.ts]"]
end

node_visitor(("Visitor"))
node_mediapipe["MediaPipe Vision"]

node_visitor -->|"opens experience"| node_app
node_app -->|"renders stage"| node_playground
node_app -->|"renders input"| node_gesture_input
node_app -->|"creates engine"| node_engine
node_visitor -->|"starts input"| node_gesture_input
node_gesture_input -->|"initializes and samples"| node_hand_tracker
node_gesture_input -->|"requests demo signals"| node_demo_hands
node_gesture_input -->|"submits hand state"| node_engine
node_hand_tracker -->|"runs landmark inference"| node_mediapipe
node_engine -->|"detects gestures"| node_detector
node_engine -->|"transitions phases"| node_state_machine
node_engine -->|"stores and emits"| node_gesture_state
node_detector -->|"smooths landmarks"| node_smoother
node_detector -->|"evaluates gestures"| node_recognizers
node_detector -->|"uses landmark math"| node_math
node_playground -.->|"presents puppet"| node_puppet
node_puppet -->|"subscribes to changes"| node_engine

click node_app "https://github.com/sawyer1995nie-cpu/mingmirror-shadow-play/blob/main/src/App.tsx"
click node_playground "https://github.com/sawyer1995nie-cpu/mingmirror-shadow-play/blob/main/src/components/ShadowPlayground.tsx"
click node_puppet "https://github.com/sawyer1995nie-cpu/mingmirror-shadow-play/blob/main/src/components/ShadowPuppet.tsx"
click node_gesture_input "https://github.com/sawyer1995nie-cpu/mingmirror-shadow-play/blob/main/src/components/GestureInput.tsx"
click node_hand_tracker "https://github.com/sawyer1995nie-cpu/mingmirror-shadow-play/blob/main/src/gesture/HandTracker.ts"
click node_demo_hands "https://github.com/sawyer1995nie-cpu/mingmirror-shadow-play/blob/main/src/utils/demoHands.ts"
click node_engine "https://github.com/sawyer1995nie-cpu/mingmirror-shadow-play/blob/main/src/gesture/GestureEngine.ts"
click node_detector "https://github.com/sawyer1995nie-cpu/mingmirror-shadow-play/blob/main/src/gesture/GestureDetector.ts"
click node_state_machine "https://github.com/sawyer1995nie-cpu/mingmirror-shadow-play/blob/main/src/gesture/GestureStateMachine.ts"
click node_gesture_state "https://github.com/sawyer1995nie-cpu/mingmirror-shadow-play/blob/main/src/gesture/GestureState.ts"
click node_smoother "https://github.com/sawyer1995nie-cpu/mingmirror-shadow-play/blob/main/src/gesture/GestureSmoother.ts"
click node_recognizers "https://github.com/sawyer1995nie-cpu/mingmirror-shadow-play/tree/main/src/gestures"
click node_math "https://github.com/sawyer1995nie-cpu/mingmirror-shadow-play/blob/main/src/utils/math.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_app,node_playground,node_puppet toneBlue
class node_gesture_input,node_hand_tracker,node_demo_hands toneAmber
class node_engine,node_detector,node_state_machine,node_gesture_state,node_mediapipe toneMint
class node_smoother,node_recognizers,node_math toneRose
class node_visitor toneIndigo
```

## Components

### Stage Experience

- [App Wiring](https://github.com/sawyer1995nie-cpu/mingmirror-shadow-play/blob/main/src/App.tsx): `src/App.tsx`
- [Shadow Stage](https://github.com/sawyer1995nie-cpu/mingmirror-shadow-play/blob/main/src/components/ShadowPlayground.tsx): `src/components/ShadowPlayground.tsx`
- [Puppet Rig](https://github.com/sawyer1995nie-cpu/mingmirror-shadow-play/blob/main/src/components/ShadowPuppet.tsx): `src/components/ShadowPuppet.tsx`

### Hand Input

- [Gesture Input](https://github.com/sawyer1995nie-cpu/mingmirror-shadow-play/blob/main/src/components/GestureInput.tsx): `src/components/GestureInput.tsx`
- [Hand Tracker](https://github.com/sawyer1995nie-cpu/mingmirror-shadow-play/blob/main/src/gesture/HandTracker.ts): `src/gesture/HandTracker.ts`
- [Demo Hands](https://github.com/sawyer1995nie-cpu/mingmirror-shadow-play/blob/main/src/utils/demoHands.ts): `src/utils/demoHands.ts`

### Gesture Engine

- [Gesture Engine](https://github.com/sawyer1995nie-cpu/mingmirror-shadow-play/blob/main/src/gesture/GestureEngine.ts): `src/gesture/GestureEngine.ts`
- [Gesture Detector](https://github.com/sawyer1995nie-cpu/mingmirror-shadow-play/blob/main/src/gesture/GestureDetector.ts): `src/gesture/GestureDetector.ts`
- [State Machine](https://github.com/sawyer1995nie-cpu/mingmirror-shadow-play/blob/main/src/gesture/GestureStateMachine.ts): `src/gesture/GestureStateMachine.ts`
- [Gesture State](https://github.com/sawyer1995nie-cpu/mingmirror-shadow-play/blob/main/src/gesture/GestureState.ts): `src/gesture/GestureState.ts`

### Gesture Support

- [Gesture Smoother](https://github.com/sawyer1995nie-cpu/mingmirror-shadow-play/blob/main/src/gesture/GestureSmoother.ts): `src/gesture/GestureSmoother.ts`
- [Gesture Recognizers](https://github.com/sawyer1995nie-cpu/mingmirror-shadow-play/tree/main/src/gestures): `src/gestures`
- [Landmark Math](https://github.com/sawyer1995nie-cpu/mingmirror-shadow-play/blob/main/src/utils/math.ts): `src/utils/math.ts`

### Other components

- **Visitor**
- **MediaPipe Vision**

## Connections

- Visitor → App Wiring: opens experience (evidence: `README.md`)
- App Wiring → Shadow Stage: renders stage (evidence: `src/App.tsx`)
- App Wiring → Gesture Input: renders input (evidence: `src/App.tsx`)
- App Wiring → Gesture Engine: creates engine (evidence: `src/App.tsx`)
- Visitor → Gesture Input: starts input (evidence: `README.md`)
- Gesture Input → Hand Tracker: initializes and samples (evidence: `src/components/GestureInput.tsx`)
- Gesture Input → Demo Hands: requests demo signals (evidence: `src/components/GestureInput.tsx`)
- Gesture Input → Gesture Engine: submits hand state (evidence: `README.md`)
- Hand Tracker → MediaPipe Vision: runs landmark inference (evidence: `src/gesture/HandTracker.ts`)
- Gesture Engine → Gesture Detector: detects gestures (evidence: `src/gesture/GestureEngine.ts`)
- Gesture Engine → State Machine: transitions phases (evidence: `src/gesture/GestureEngine.ts`)
- Gesture Engine → Gesture State: stores and emits (evidence: `src/gesture/GestureEngine.ts`)
- Gesture Detector → Gesture Smoother: smooths landmarks (evidence: `src/gesture/GestureDetector.ts`)
- Gesture Detector → Gesture Recognizers: evaluates gestures (evidence: `src/gesture/GestureDetector.ts`)
- Gesture Detector → Landmark Math: uses landmark math (evidence: `src/gesture/GestureDetector.ts`)
- Shadow Stage → Puppet Rig: presents puppet
- Puppet Rig → Gesture Engine: subscribes to changes (evidence: `src/components/ShadowPuppet.tsx`)
