# vighanesh2/seathrough architecture

> Architecture diagram of the GitHub repository vighanesh2/seathrough, 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/vighanesh2/seathrough
- Repository: https://github.com/vighanesh2/seathrough

## Overview

This repository is a multi-mode visual education application: learners ask questions or submit material, and receive streamed lessons, explanations, diagrams, or interactive boards. The clearest evidenced workflow is the lesson-stream API invoking the lesson orchestrator; lesson types describe streamed events and visual plans. Other substantial product branches include anatomy Q&A, screenshot explanation, drawing, experiment authoring, and video explanation. The README is only the default Next.js template, so feature relationships beyond sampled source and SOURCE INDEX references are shown only where supported; unsampled integrations are omitted.

Main entry points: [`src/app/api/lesson/mcq/route.ts`](https://github.com/vighanesh2/seathrough/blob/main/src/app/api/lesson/mcq/route.ts) (Lesson quiz API), [`src/components/draw-engine/DrawEngineShell.tsx`](https://github.com/vighanesh2/seathrough/blob/main/src/components/draw-engine/DrawEngineShell.tsx) (Drawing workspace), [`src/app/api/anatomy/ask/route.ts`](https://github.com/vighanesh2/seathrough/blob/main/src/app/api/anatomy/ask/route.ts) (Anatomy Q&A API), [`src/lib/experiment/client.ts`](https://github.com/vighanesh2/seathrough/blob/main/src/lib/experiment/client.ts) (Experiment client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_learning["Lesson learning"]
  node_lesson_api["Lesson stream API<br/>[route.ts]"]
  node_lesson_runner["Lesson orchestrator<br/>[runLessonStream.ts]"]
  node_lesson_events["Lesson event model<br/>[lesson.ts]"]
  node_mcq_api["Lesson quiz API<br/>[route.ts]"]
  node_mcq_generator["Quiz generator<br/>[generateMcq.ts]"]
end

subgraph group_visuals["Visual creation"]
  node_visual_router["Visual selection<br/>[router.ts]"]
  node_scene_recipe["Scene recipe builder"]
  node_draw_shell["Drawing workspace"]
  node_draw_stream["Drawing stream consumer"]
  node_draw_stage["Konva drawing stage<br/>[KonvaDrawStage.tsx]"]
end

subgraph group_specialized["Specialized learning"]
  node_anatomy_api["Anatomy Q&amp;A API<br/>[route.ts]"]
  node_anatomy_answer["Grounded anatomy answers<br/>[answer.ts]"]
  node_anatomy_knowledge["Anatomy knowledge"]
  node_image_api["Image explanation API<br/>[route.ts]"]
  node_image_pipeline["Image explanation pipeline<br/>[pipeline.ts]"]
end

subgraph group_media["Media workflows"]
  node_experiment_scene["Experiment scene model<br/>[scene.ts]"]
  node_experiment_client["Experiment client<br/>[client.ts]"]
  node_video_api["Video explanation API<br/>[route.ts]"]
  node_video_generator["Video generation<br/>[generate.ts]"]
  node_film_engine["Film engine<br/>[core.js]"]
end

subgraph group_platform["Shared platform"]
  node_conversation_store[("Conversation context<br/>[store.ts]")]
  node_service_store[("Supabase service access<br/>[server.ts]")]
end

node_learner(("Learner"))

node_learner -->|"requests lesson"| node_lesson_api
node_lesson_api -->|"starts stream"| node_lesson_runner
node_lesson_runner -.->|"emits events"| node_lesson_events
node_learner -->|"requests quiz"| node_mcq_api
node_mcq_api -->|"loads context"| node_conversation_store
node_mcq_api -->|"generates questions"| node_mcq_generator
node_learner -->|"draws prompt"| node_draw_shell
node_draw_shell -->|"consumes stream"| node_draw_stream
node_draw_shell -->|"renders stage"| node_draw_stage
node_learner -->|"asks anatomy"| node_anatomy_api
node_anatomy_api -->|"retrieves knowledge"| node_anatomy_knowledge
node_anatomy_api -->|"generates answer"| node_anatomy_answer
node_learner -.->|"submits image"| node_image_api
node_image_api -->|"runs pipeline"| node_image_pipeline
node_image_pipeline -.->|"creates lesson prompt"| node_scene_recipe
node_learner -.->|"creates experiment"| node_experiment_client
node_experiment_client -->|"uses scene model"| node_experiment_scene
node_learner -.->|"requests explanation"| node_video_api
node_video_api -->|"generates video"| node_video_generator
node_video_generator -.->|"uses film runtime"| node_film_engine
node_experiment_client -.->|"persists videos"| node_service_store
node_visual_router -->|"builds fallback scene"| node_scene_recipe

click node_lesson_api "https://github.com/vighanesh2/seathrough/blob/main/src/app/api/lesson/stream/route.ts"
click node_lesson_runner "https://github.com/vighanesh2/seathrough/blob/main/src/lib/orchestrator/runLessonStream.ts"
click node_lesson_events "https://github.com/vighanesh2/seathrough/blob/main/src/types/lesson.ts"
click node_mcq_api "https://github.com/vighanesh2/seathrough/blob/main/src/app/api/lesson/mcq/route.ts"
click node_mcq_generator "https://github.com/vighanesh2/seathrough/blob/main/src/lib/lesson/generateMcq.ts"
click node_conversation_store "https://github.com/vighanesh2/seathrough/blob/main/src/lib/conversations/store.ts"
click node_visual_router "https://github.com/vighanesh2/seathrough/blob/main/src/lib/visuals/router.ts"
click node_scene_recipe "https://github.com/vighanesh2/seathrough/blob/main/src/lib/diagrams/buildSceneRecipe.ts"
click node_draw_shell "https://github.com/vighanesh2/seathrough/blob/main/src/components/draw-engine/DrawEngineShell.tsx"
click node_draw_stream "https://github.com/vighanesh2/seathrough/blob/main/src/lib/draw-engine/consumeDrawStream.ts"
click node_draw_stage "https://github.com/vighanesh2/seathrough/blob/main/src/components/draw-engine/KonvaDrawStage.tsx"
click node_anatomy_api "https://github.com/vighanesh2/seathrough/blob/main/src/app/api/anatomy/ask/route.ts"
click node_anatomy_answer "https://github.com/vighanesh2/seathrough/blob/main/src/lib/anatomy/answer.ts"
click node_anatomy_knowledge "https://github.com/vighanesh2/seathrough/tree/main/src/lib/anatomy/knowledge"
click node_image_api "https://github.com/vighanesh2/seathrough/blob/main/src/app/api/image-explain/route.ts"
click node_image_pipeline "https://github.com/vighanesh2/seathrough/blob/main/src/lib/image-explain/pipeline.ts"
click node_experiment_scene "https://github.com/vighanesh2/seathrough/blob/main/src/lib/experiment/scene.ts"
click node_experiment_client "https://github.com/vighanesh2/seathrough/blob/main/src/lib/experiment/client.ts"
click node_video_api "https://github.com/vighanesh2/seathrough/blob/main/src/app/api/explain-video/route.ts"
click node_video_generator "https://github.com/vighanesh2/seathrough/blob/main/src/lib/explain-video/generate.ts"
click node_film_engine "https://github.com/vighanesh2/seathrough/blob/main/public/film-engine/core.js"
click node_service_store "https://github.com/vighanesh2/seathrough/blob/main/src/lib/supabase/server.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_lesson_api,node_lesson_runner,node_lesson_events,node_mcq_api,node_mcq_generator toneBlue
class node_visual_router,node_scene_recipe,node_draw_shell,node_draw_stream,node_draw_stage toneAmber
class node_anatomy_api,node_anatomy_answer,node_anatomy_knowledge,node_image_api,node_image_pipeline toneMint
class node_experiment_scene,node_experiment_client,node_video_api,node_video_generator,node_film_engine toneRose
class node_conversation_store,node_service_store,node_learner toneIndigo
```

## Components

### Lesson learning

- [Lesson stream API](https://github.com/vighanesh2/seathrough/blob/main/src/app/api/lesson/stream/route.ts): `src/app/api/lesson/stream/route.ts`
- [Lesson orchestrator](https://github.com/vighanesh2/seathrough/blob/main/src/lib/orchestrator/runLessonStream.ts): `src/lib/orchestrator/runLessonStream.ts`
- [Lesson event model](https://github.com/vighanesh2/seathrough/blob/main/src/types/lesson.ts): `src/types/lesson.ts`
- [Lesson quiz API](https://github.com/vighanesh2/seathrough/blob/main/src/app/api/lesson/mcq/route.ts): `src/app/api/lesson/mcq/route.ts`
- [Quiz generator](https://github.com/vighanesh2/seathrough/blob/main/src/lib/lesson/generateMcq.ts): `src/lib/lesson/generateMcq.ts`

### Visual creation

- [Visual selection](https://github.com/vighanesh2/seathrough/blob/main/src/lib/visuals/router.ts): `src/lib/visuals/router.ts`
- [Scene recipe builder](https://github.com/vighanesh2/seathrough/blob/main/src/lib/diagrams/buildSceneRecipe.ts): `src/lib/diagrams/buildSceneRecipe.ts`
- [Drawing workspace](https://github.com/vighanesh2/seathrough/blob/main/src/components/draw-engine/DrawEngineShell.tsx): `src/components/draw-engine/DrawEngineShell.tsx`
- [Drawing stream consumer](https://github.com/vighanesh2/seathrough/blob/main/src/lib/draw-engine/consumeDrawStream.ts): `src/lib/draw-engine/consumeDrawStream.ts`
- [Konva drawing stage](https://github.com/vighanesh2/seathrough/blob/main/src/components/draw-engine/KonvaDrawStage.tsx): `src/components/draw-engine/KonvaDrawStage.tsx`

### Specialized learning

- [Anatomy Q&A API](https://github.com/vighanesh2/seathrough/blob/main/src/app/api/anatomy/ask/route.ts): `src/app/api/anatomy/ask/route.ts`
- [Grounded anatomy answers](https://github.com/vighanesh2/seathrough/blob/main/src/lib/anatomy/answer.ts): `src/lib/anatomy/answer.ts`
- [Anatomy knowledge](https://github.com/vighanesh2/seathrough/tree/main/src/lib/anatomy/knowledge): `src/lib/anatomy/knowledge`
- [Image explanation API](https://github.com/vighanesh2/seathrough/blob/main/src/app/api/image-explain/route.ts): `src/app/api/image-explain/route.ts`
- [Image explanation pipeline](https://github.com/vighanesh2/seathrough/blob/main/src/lib/image-explain/pipeline.ts): `src/lib/image-explain/pipeline.ts`

### Media workflows

- [Experiment scene model](https://github.com/vighanesh2/seathrough/blob/main/src/lib/experiment/scene.ts): `src/lib/experiment/scene.ts`
- [Experiment client](https://github.com/vighanesh2/seathrough/blob/main/src/lib/experiment/client.ts): `src/lib/experiment/client.ts`
- [Video explanation API](https://github.com/vighanesh2/seathrough/blob/main/src/app/api/explain-video/route.ts): `src/app/api/explain-video/route.ts`
- [Video generation](https://github.com/vighanesh2/seathrough/blob/main/src/lib/explain-video/generate.ts): `src/lib/explain-video/generate.ts`
- [Film engine](https://github.com/vighanesh2/seathrough/blob/main/public/film-engine/core.js): `public/film-engine/core.js`

### Shared platform

- [Conversation context](https://github.com/vighanesh2/seathrough/blob/main/src/lib/conversations/store.ts): `src/lib/conversations/store.ts`
- [Supabase service access](https://github.com/vighanesh2/seathrough/blob/main/src/lib/supabase/server.ts): `src/lib/supabase/server.ts`

### Other components

- **Learner**

## Connections

- Learner → Lesson stream API: requests lesson (evidence: `src/app/api/lesson/stream/route.ts`)
- Lesson stream API → Lesson orchestrator: starts stream (evidence: `src/app/api/lesson/stream/route.ts`)
- Lesson orchestrator → Lesson event model: emits events
- Learner → Lesson quiz API: requests quiz (evidence: `src/app/api/lesson/mcq/route.ts`)
- Lesson quiz API → Conversation context: loads context (evidence: `src/app/api/lesson/mcq/route.ts`)
- Lesson quiz API → Quiz generator: generates questions (evidence: `src/app/api/lesson/mcq/route.ts`)
- Learner → Drawing workspace: draws prompt (evidence: `src/components/draw-engine/DrawEngineShell.tsx`)
- Drawing workspace → Drawing stream consumer: consumes stream (evidence: `src/components/draw-engine/DrawEngineShell.tsx`)
- Drawing workspace → Konva drawing stage: renders stage (evidence: `src/components/draw-engine/DrawEngineShell.tsx`)
- Learner → Anatomy Q&A API: asks anatomy (evidence: `src/app/api/anatomy/ask/route.ts`)
- Anatomy Q&A API → Anatomy knowledge: retrieves knowledge (evidence: `src/app/api/anatomy/ask/route.ts`)
- Anatomy Q&A API → Grounded anatomy answers: generates answer (evidence: `src/app/api/anatomy/ask/route.ts`)
- Learner → Image explanation API: submits image
- Image explanation API → Image explanation pipeline: runs pipeline (evidence: `src/app/api/image-explain/route.ts`)
- Image explanation pipeline → Scene recipe builder: creates lesson prompt
- Learner → Experiment client: creates experiment
- Experiment client → Experiment scene model: uses scene model (evidence: `src/lib/experiment/client.ts`)
- Learner → Video explanation API: requests explanation
- Video explanation API → Video generation: generates video (evidence: `src/app/api/explain-video/route.ts`)
- Video generation → Film engine: uses film runtime
- Experiment client → Supabase service access: persists videos
- Visual selection → Scene recipe builder: builds fallback scene (evidence: `src/lib/visuals/router.ts`)
