# rebots-online/swingfx architecture

> Architecture diagram of the GitHub repository rebots-online/swingfx, 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/rebots-online/swingfx
- Repository: https://github.com/rebots-online/swingfx
- Video tour (about a minute): https://gitdiagram.com/rebots-online/swingfx/video

## Overview

SwingF/X is a squash technique coaching app that analyzes recorded swings and supports a learn-and-retest loop. The principal flow runs from player interaction in the workspace through pose extraction, movement analysis and coaching feedback, then supports intervention and retention checks. The UI also provides video and 3D inspection, evidence review, voice/chat coaching, configurable heuristics, and extensibility adapters. Edges follow shown imports or calls; some product branches are documented by the source index, while their internal behavior was not sampled.

Main entry points: [`src/App.tsx`](https://github.com/rebots-online/swingfx/blob/main/src/App.tsx) (Learning loop), [`src/services/diagnosticEngine.ts`](https://github.com/rebots-online/swingfx/blob/main/src/services/diagnosticEngine.ts) (Technique diagnostics), [`src/services/poseEngine.ts`](https://github.com/rebots-online/swingfx/blob/main/src/services/poseEngine.ts) (Pose extraction), [`src/components/VideoPoseCanvas.tsx`](https://github.com/rebots-online/swingfx/blob/main/src/components/VideoPoseCanvas.tsx) (Video pose viewer)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workspace["Coaching workspace"]
  node_app["Learning loop<br/>[App.tsx]"]
  node_video["Video pose viewer"]
  node_skeleton["3D skeleton inspector"]
end

subgraph group_analysis["Movement analysis"]
  node_pose["Pose extraction<br/>[poseEngine.ts]"]
  node_reference["Reference sequences"]
  node_diagnostics["Technique diagnostics"]
  node_kinematics["Kinematics and phases"]
  node_alignment["Retest alignment<br/>[dtwEngine.ts]"]
end

subgraph group_coaching["Coaching and review"]
  node_heuristics["Fault heuristics<br/>[heuristics.ts]"]
  node_evidence["Evidence and coach review<br/>[EvidenceDrawer.tsx]"]
  node_voice["Voice drill coach"]
  node_chat["Coach chat<br/>[CoachChatPanel.tsx]"]
  node_adapters["Extensibility adapters"]
end

subgraph group_state["Local state and contracts"]
  node_storage[("Browser persistence")]
  node_contracts["Domain contracts<br/>[swingfx.ts]"]
end

node_player(("Player"))

node_player -->|"uses"| node_app
node_app -->|"analyzes clips"| node_pose
node_app -->|"assesses technique"| node_diagnostics
node_app -->|"loads and saves"| node_storage
node_app -->|"configures thresholds"| node_heuristics
node_app -->|"renders viewer"| node_video
node_app -->|"renders inspector"| node_skeleton
node_app -->|"renders review"| node_evidence
node_app -->|"renders coaching"| node_voice
node_app -->|"renders chat"| node_chat
node_app -->|"uses adapters"| node_adapters
node_pose -->|"generates reference poses"| node_reference
node_diagnostics -->|"segments and measures"| node_kinematics
node_diagnostics -->|"aligns retests"| node_alignment

click node_app "https://github.com/rebots-online/swingfx/blob/main/src/App.tsx"
click node_pose "https://github.com/rebots-online/swingfx/blob/main/src/services/poseEngine.ts"
click node_reference "https://github.com/rebots-online/swingfx/blob/main/src/services/videoReferenceGenerator.ts"
click node_diagnostics "https://github.com/rebots-online/swingfx/blob/main/src/services/diagnosticEngine.ts"
click node_kinematics "https://github.com/rebots-online/swingfx/blob/main/src/services/kinematicsEngine.ts"
click node_alignment "https://github.com/rebots-online/swingfx/blob/main/src/services/dtwEngine.ts"
click node_heuristics "https://github.com/rebots-online/swingfx/blob/main/src/config/heuristics.ts"
click node_video "https://github.com/rebots-online/swingfx/blob/main/src/components/VideoPoseCanvas.tsx"
click node_skeleton "https://github.com/rebots-online/swingfx/blob/main/src/components/SkeletonInspector3D.tsx"
click node_evidence "https://github.com/rebots-online/swingfx/blob/main/src/components/EvidenceDrawer.tsx"
click node_voice "https://github.com/rebots-online/swingfx/blob/main/src/components/VoiceDrillCoach.tsx"
click node_chat "https://github.com/rebots-online/swingfx/blob/main/src/components/CoachChatPanel.tsx"
click node_adapters "https://github.com/rebots-online/swingfx/blob/main/src/services/extensibilityAdapters.tsx"
click node_storage "https://github.com/rebots-online/swingfx/blob/main/src/services/storageRepository.ts"
click node_contracts "https://github.com/rebots-online/swingfx/blob/main/src/types/swingfx.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_video,node_skeleton toneBlue
class node_pose,node_reference,node_diagnostics,node_kinematics,node_alignment toneAmber
class node_heuristics,node_evidence,node_voice,node_chat,node_adapters toneMint
class node_storage,node_contracts toneRose
class node_player toneIndigo
```

## Components

### Coaching workspace

- [Learning loop](https://github.com/rebots-online/swingfx/blob/main/src/App.tsx): `src/App.tsx`
- [Video pose viewer](https://github.com/rebots-online/swingfx/blob/main/src/components/VideoPoseCanvas.tsx): `src/components/VideoPoseCanvas.tsx`
- [3D skeleton inspector](https://github.com/rebots-online/swingfx/blob/main/src/components/SkeletonInspector3D.tsx): `src/components/SkeletonInspector3D.tsx`

### Movement analysis

- [Pose extraction](https://github.com/rebots-online/swingfx/blob/main/src/services/poseEngine.ts): `src/services/poseEngine.ts`
- [Reference sequences](https://github.com/rebots-online/swingfx/blob/main/src/services/videoReferenceGenerator.ts): `src/services/videoReferenceGenerator.ts`
- [Technique diagnostics](https://github.com/rebots-online/swingfx/blob/main/src/services/diagnosticEngine.ts): `src/services/diagnosticEngine.ts`
- [Kinematics and phases](https://github.com/rebots-online/swingfx/blob/main/src/services/kinematicsEngine.ts): `src/services/kinematicsEngine.ts`
- [Retest alignment](https://github.com/rebots-online/swingfx/blob/main/src/services/dtwEngine.ts): `src/services/dtwEngine.ts`

### Coaching and review

- [Fault heuristics](https://github.com/rebots-online/swingfx/blob/main/src/config/heuristics.ts): `src/config/heuristics.ts`
- [Evidence and coach review](https://github.com/rebots-online/swingfx/blob/main/src/components/EvidenceDrawer.tsx): `src/components/EvidenceDrawer.tsx`
- [Voice drill coach](https://github.com/rebots-online/swingfx/blob/main/src/components/VoiceDrillCoach.tsx): `src/components/VoiceDrillCoach.tsx`
- [Coach chat](https://github.com/rebots-online/swingfx/blob/main/src/components/CoachChatPanel.tsx): `src/components/CoachChatPanel.tsx`
- [Extensibility adapters](https://github.com/rebots-online/swingfx/blob/main/src/services/extensibilityAdapters.tsx): `src/services/extensibilityAdapters.tsx`

### Local state and contracts

- [Browser persistence](https://github.com/rebots-online/swingfx/blob/main/src/services/storageRepository.ts): `src/services/storageRepository.ts`
- [Domain contracts](https://github.com/rebots-online/swingfx/blob/main/src/types/swingfx.ts): `src/types/swingfx.ts`

### Other components

- **Player**

## Connections

- Player → Learning loop: uses (evidence: `src/App.tsx`)
- Learning loop → Pose extraction: analyzes clips (evidence: `src/App.tsx`)
- Learning loop → Technique diagnostics: assesses technique (evidence: `src/App.tsx`)
- Learning loop → Browser persistence: loads and saves (evidence: `src/App.tsx`)
- Learning loop → Fault heuristics: configures thresholds (evidence: `src/App.tsx`)
- Learning loop → Video pose viewer: renders viewer (evidence: `src/App.tsx`)
- Learning loop → 3D skeleton inspector: renders inspector (evidence: `src/App.tsx`)
- Learning loop → Evidence and coach review: renders review (evidence: `src/App.tsx`)
- Learning loop → Voice drill coach: renders coaching (evidence: `src/App.tsx`)
- Learning loop → Coach chat: renders chat (evidence: `src/App.tsx`)
- Learning loop → Extensibility adapters: uses adapters (evidence: `src/App.tsx`)
- Pose extraction → Reference sequences: generates reference poses (evidence: `src/services/poseEngine.ts`)
- Technique diagnostics → Kinematics and phases: segments and measures (evidence: `src/services/diagnosticEngine.ts`)
- Technique diagnostics → Retest alignment: aligns retests (evidence: `src/services/diagnosticEngine.ts`)
