# felipeah-dev/reflektor architecture

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

- Interactive diagram: https://gitdiagram.com/felipeah-dev/reflektor
- Repository: https://github.com/felipeah-dev/reflektor

## Overview

Reflektor is a browser-based video coaching app: users configure a practice scenario and devices, record a session, submit it for AI analysis, then review feedback and chat with a coach. The tree and source index establish the major screens and components; some page implementations and the Gemini client/API wiring were not excerpted, so uncertain transitions are omitted or marked unverified.

Main entry points: [`src/app/recording/page.tsx`](https://github.com/felipeah-dev/reflektor/blob/main/src/app/recording/page.tsx) (Recording Screen), [`src/components/features/media/ChatCoach.tsx`](https://github.com/felipeah-dev/reflektor/blob/main/src/components/features/media/ChatCoach.tsx) (Chat Coach), [`src/lib/sessionStore.ts`](https://github.com/felipeah-dev/reflektor/blob/main/src/lib/sessionStore.ts) (Session Store), [`src/app/processing/page.tsx`](https://github.com/felipeah-dev/reflektor/blob/main/src/app/processing/page.tsx) (Analysis Progress)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_practice["Practice Flow"]
  node_home["Home<br/>[page.tsx]"]
  node_setup["Session Setup<br/>[page.tsx]"]
  node_action["Action Guide<br/>[page.tsx]"]
  node_recording["Recording Screen<br/>[page.tsx]"]
  node_processing["Analysis Progress<br/>[page.tsx]"]
  node_settings["Settings<br/>[page.tsx]"]
end

subgraph group_review["Review &amp; Coaching"]
  node_results["Results Screen<br/>[page.tsx]"]
  node_canvas["Results Canvas<br/>[ResultsCanvas.tsx]"]
  node_coach["Chat Coach<br/>[ChatCoach.tsx]"]
  node_chat["Chat Client<br/>[chat.ts]"]
end

subgraph group_services["AI Services"]
  node_analyze["Video Analysis API<br/>[route.ts]"]
  node_chatapi["Chat API<br/>[route.ts]"]
  node_keys["Gemini Key Pool<br/>[geminiKeys.ts]"]
  node_limiter["Rate Limiter<br/>[rateLimit.ts]"]
  node_gemini["Gemini Client<br/>[gemini.ts]"]
end

subgraph group_shared["Media &amp; State"]
  node_camera["Camera Preview<br/>[CameraPreview.tsx]"]
  node_recorder["Media Recorder"]
  node_visualizer["Audio Visualizer"]
  node_sessions[("Session Store<br/>[sessionStore.ts]")]
  node_network["Network Monitor"]
end

node_user(("Practitioner"))
node_google{{"Google Gemini"}}

node_user -->|"opens"| node_home
node_recording -->|"renders"| node_camera
node_recording -->|"renders"| node_visualizer
node_recording -.->|"uses"| node_recorder
node_recording -.->|"uses"| node_sessions
node_processing -.->|"uses"| node_sessions
node_processing -.->|"uses"| node_gemini
node_processing -.->|"uses"| node_network
node_results -->|"reads"| node_sessions
node_results -->|"renders"| node_canvas
node_results -->|"renders"| node_coach
node_coach -->|"requests replies"| node_chat
node_coach -->|"checks"| node_network
node_coach -.->|"uses"| node_sessions
node_chatapi -->|"loads"| node_keys
node_chatapi -->|"checks"| node_limiter
node_chatapi -->|"sends chat"| node_google
node_analyze -->|"loads"| node_keys
node_analyze -->|"checks"| node_limiter
node_analyze -->|"submits media"| node_google

click node_home "https://github.com/felipeah-dev/reflektor/blob/main/src/app/page.tsx"
click node_setup "https://github.com/felipeah-dev/reflektor/blob/main/src/app/setup/page.tsx"
click node_action "https://github.com/felipeah-dev/reflektor/blob/main/src/app/action/page.tsx"
click node_recording "https://github.com/felipeah-dev/reflektor/blob/main/src/app/recording/page.tsx"
click node_processing "https://github.com/felipeah-dev/reflektor/blob/main/src/app/processing/page.tsx"
click node_settings "https://github.com/felipeah-dev/reflektor/blob/main/src/app/settings/page.tsx"
click node_camera "https://github.com/felipeah-dev/reflektor/blob/main/src/components/features/media/CameraPreview.tsx"
click node_recorder "https://github.com/felipeah-dev/reflektor/blob/main/src/hooks/useMediaRecorder.ts"
click node_visualizer "https://github.com/felipeah-dev/reflektor/blob/main/src/components/features/media/AudioVisualizer.tsx"
click node_sessions "https://github.com/felipeah-dev/reflektor/blob/main/src/lib/sessionStore.ts"
click node_network "https://github.com/felipeah-dev/reflektor/blob/main/src/hooks/useNetworkQuality.ts"
click node_results "https://github.com/felipeah-dev/reflektor/blob/main/src/app/results/page.tsx"
click node_canvas "https://github.com/felipeah-dev/reflektor/blob/main/src/components/features/media/ResultsCanvas.tsx"
click node_coach "https://github.com/felipeah-dev/reflektor/blob/main/src/components/features/media/ChatCoach.tsx"
click node_chat "https://github.com/felipeah-dev/reflektor/blob/main/src/lib/chat.ts"
click node_analyze "https://github.com/felipeah-dev/reflektor/blob/main/src/app/api/gemini/analyze/route.ts"
click node_chatapi "https://github.com/felipeah-dev/reflektor/blob/main/src/app/api/gemini/chat/route.ts"
click node_keys "https://github.com/felipeah-dev/reflektor/blob/main/src/lib/geminiKeys.ts"
click node_limiter "https://github.com/felipeah-dev/reflektor/blob/main/src/lib/rateLimit.ts"
click node_gemini "https://github.com/felipeah-dev/reflektor/blob/main/src/lib/gemini.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_home,node_setup,node_action,node_recording,node_processing,node_settings toneBlue
class node_results,node_canvas,node_coach,node_chat toneAmber
class node_analyze,node_chatapi,node_keys,node_limiter,node_gemini toneMint
class node_camera,node_recorder,node_visualizer,node_sessions,node_network toneRose
class node_user,node_google toneIndigo
```

## Components

### Practice Flow

- [Home](https://github.com/felipeah-dev/reflektor/blob/main/src/app/page.tsx): `src/app/page.tsx`
- [Session Setup](https://github.com/felipeah-dev/reflektor/blob/main/src/app/setup/page.tsx): `src/app/setup/page.tsx`
- [Action Guide](https://github.com/felipeah-dev/reflektor/blob/main/src/app/action/page.tsx): `src/app/action/page.tsx`
- [Recording Screen](https://github.com/felipeah-dev/reflektor/blob/main/src/app/recording/page.tsx): `src/app/recording/page.tsx`
- [Analysis Progress](https://github.com/felipeah-dev/reflektor/blob/main/src/app/processing/page.tsx): `src/app/processing/page.tsx`
- [Settings](https://github.com/felipeah-dev/reflektor/blob/main/src/app/settings/page.tsx): `src/app/settings/page.tsx`

### Review & Coaching

- [Results Screen](https://github.com/felipeah-dev/reflektor/blob/main/src/app/results/page.tsx): `src/app/results/page.tsx`
- [Results Canvas](https://github.com/felipeah-dev/reflektor/blob/main/src/components/features/media/ResultsCanvas.tsx): `src/components/features/media/ResultsCanvas.tsx`
- [Chat Coach](https://github.com/felipeah-dev/reflektor/blob/main/src/components/features/media/ChatCoach.tsx): `src/components/features/media/ChatCoach.tsx`
- [Chat Client](https://github.com/felipeah-dev/reflektor/blob/main/src/lib/chat.ts): `src/lib/chat.ts`

### AI Services

- [Video Analysis API](https://github.com/felipeah-dev/reflektor/blob/main/src/app/api/gemini/analyze/route.ts): `src/app/api/gemini/analyze/route.ts`
- [Chat API](https://github.com/felipeah-dev/reflektor/blob/main/src/app/api/gemini/chat/route.ts): `src/app/api/gemini/chat/route.ts`
- [Gemini Key Pool](https://github.com/felipeah-dev/reflektor/blob/main/src/lib/geminiKeys.ts): `src/lib/geminiKeys.ts`
- [Rate Limiter](https://github.com/felipeah-dev/reflektor/blob/main/src/lib/rateLimit.ts): `src/lib/rateLimit.ts`
- [Gemini Client](https://github.com/felipeah-dev/reflektor/blob/main/src/lib/gemini.ts): `src/lib/gemini.ts`

### Media & State

- [Camera Preview](https://github.com/felipeah-dev/reflektor/blob/main/src/components/features/media/CameraPreview.tsx): `src/components/features/media/CameraPreview.tsx`
- [Media Recorder](https://github.com/felipeah-dev/reflektor/blob/main/src/hooks/useMediaRecorder.ts): `src/hooks/useMediaRecorder.ts`
- [Audio Visualizer](https://github.com/felipeah-dev/reflektor/blob/main/src/components/features/media/AudioVisualizer.tsx): `src/components/features/media/AudioVisualizer.tsx`
- [Session Store](https://github.com/felipeah-dev/reflektor/blob/main/src/lib/sessionStore.ts): `src/lib/sessionStore.ts`
- [Network Monitor](https://github.com/felipeah-dev/reflektor/blob/main/src/hooks/useNetworkQuality.ts): `src/hooks/useNetworkQuality.ts`

### Other components

- **Practitioner**
- **Google Gemini**

## Connections

- Practitioner → Home: opens
- Recording Screen → Camera Preview: renders (evidence: `src/app/recording/page.tsx`)
- Recording Screen → Audio Visualizer: renders (evidence: `src/app/recording/page.tsx`)
- Recording Screen → Media Recorder: uses (evidence: `src/app/recording/page.tsx`)
- Recording Screen → Session Store: uses (evidence: `src/app/recording/page.tsx`)
- Analysis Progress → Session Store: uses (evidence: `src/app/processing/page.tsx`)
- Analysis Progress → Gemini Client: uses (evidence: `src/app/processing/page.tsx`)
- Analysis Progress → Network Monitor: uses (evidence: `src/app/processing/page.tsx`)
- Results Screen → Session Store: reads (evidence: `src/app/results/page.tsx`)
- Results Screen → Results Canvas: renders (evidence: `src/app/results/page.tsx`)
- Results Screen → Chat Coach: renders (evidence: `src/app/results/page.tsx`)
- Chat Coach → Chat Client: requests replies (evidence: `src/components/features/media/ChatCoach.tsx`)
- Chat Coach → Network Monitor: checks (evidence: `src/components/features/media/ChatCoach.tsx`)
- Chat Coach → Session Store: uses (evidence: `src/components/features/media/ChatCoach.tsx`)
- Chat API → Gemini Key Pool: loads (evidence: `src/app/api/gemini/chat/route.ts`)
- Chat API → Rate Limiter: checks (evidence: `src/app/api/gemini/chat/route.ts`)
- Chat API → Google Gemini: sends chat (evidence: `src/app/api/gemini/chat/route.ts`)
- Video Analysis API → Gemini Key Pool: loads (evidence: `src/app/api/gemini/analyze/route.ts`)
- Video Analysis API → Rate Limiter: checks (evidence: `src/app/api/gemini/analyze/route.ts`)
- Video Analysis API → Google Gemini: submits media (evidence: `src/app/api/gemini/analyze/route.ts`)
