# wanggit/openmaic architecture

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

## Overview

OpenMAIC is an AI-powered interactive classroom platform. A learner starts from a topic or uploaded material; server-side generation creates a course, which is stored and presented as a classroom with slides, quizzes, interactive scenes, and PBL activities. Learners can engage with agent discussions, speech, and whiteboard actions, while editors modify course content and export features provide downloadable outputs. The graph combines README-documented capabilities with relationships visible in the source index and excerpts; unsampled subsystems are included where documented, without asserting unverified internal calls.

Main entry points: [`app/workbench/new/page.tsx`](https://github.com/wanggit/openmaic/blob/main/app/workbench/new/page.tsx) (Course workbench), [`lib/document-store/index.ts`](https://github.com/wanggit/openmaic/blob/main/lib/document-store/index.ts) (Course persistence), [`app/api/materials/route.ts`](https://github.com/wanggit/openmaic/blob/main/app/api/materials/route.ts) (Material intake), [`lib/server/generation/run/engine.ts`](https://github.com/wanggit/openmaic/blob/main/lib/server/generation/run/engine.ts) (Course generation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_creation["Course creation"]
  node_workbench["Course workbench<br/>[page.tsx]"]
  node_materials["Material intake<br/>[route.ts]"]
  node_generation["Course generation<br/>[engine.ts]"]
  node_generation_api["Generation APIs<br/>[route.ts]"]
end

subgraph group_classroom["Classroom experience"]
  node_classroom_view["Classroom viewer<br/>[page.tsx]"]
  node_scene_renderer["Scene renderer<br/>[scene-renderer.tsx]"]
  node_pbl["PBL experience<br/>[pbl-renderer.tsx]"]
  node_chat["Agent discussion<br/>[chat-area.tsx]"]
  node_chat_api["Chat API<br/>[route.ts]"]
  node_whiteboard["Whiteboard actions<br/>[engine.ts]"]
  node_playback["Playback engine<br/>[engine.ts]"]
  node_export["Classroom export<br/>[index.ts]"]
end

subgraph group_editing["Editing and playback"]
  node_canvas_state["Canvas state<br/>[canvas.ts]"]
  node_editor["Course editor<br/>[EditShell.tsx]"]
  node_canvas_operations["Canvas operations"]
end

subgraph group_platform["Platform services"]
  node_course_store[("Course persistence<br/>[index.ts]")]
  node_persistence_api["Persistence API<br/>[route.ts]"]
  node_provider_settings["Model settings<br/>[index.tsx]"]
  node_provider_api["Provider APIs<br/>[route.ts]"]
end

node_learner(("Learner"))

node_learner -->|"starts lesson"| node_workbench
node_workbench -->|"attaches materials"| node_materials
node_workbench -->|"requests generation"| node_generation_api
node_generation_api -.->|"runs pipeline"| node_generation
node_generation -->|"persists course"| node_course_store
node_materials -->|"stores materials"| node_course_store
node_learner -->|"opens course"| node_classroom_view
node_classroom_view -.->|"renders scenes"| node_scene_renderer
node_scene_renderer -.->|"renders PBL"| node_pbl
node_learner -->|"joins discussion"| node_chat
node_chat -.->|"sends messages"| node_chat_api
node_playback -->|"executes actions"| node_whiteboard
node_whiteboard -->|"updates state"| node_canvas_state
node_learner -->|"edits course"| node_editor
node_editor -.->|"uses operations"| node_canvas_operations
node_canvas_operations -->|"updates canvas"| node_canvas_state
node_learner -->|"exports classroom"| node_export
node_provider_settings -.->|"configures providers"| node_provider_api
node_persistence_api -->|"accesses documents"| node_course_store

click node_workbench "https://github.com/wanggit/openmaic/blob/main/app/workbench/new/page.tsx"
click node_materials "https://github.com/wanggit/openmaic/blob/main/app/api/materials/route.ts"
click node_generation "https://github.com/wanggit/openmaic/blob/main/lib/server/generation/run/engine.ts"
click node_generation_api "https://github.com/wanggit/openmaic/blob/main/app/api/generation-runs/route.ts"
click node_course_store "https://github.com/wanggit/openmaic/blob/main/lib/document-store/index.ts"
click node_persistence_api "https://github.com/wanggit/openmaic/blob/main/app/api/persistence/%5B...path%5D/route.ts"
click node_classroom_view "https://github.com/wanggit/openmaic/blob/main/app/classroom/%5Bid%5D/page.tsx"
click node_scene_renderer "https://github.com/wanggit/openmaic/blob/main/components/stage/scene-renderer.tsx"
click node_pbl "https://github.com/wanggit/openmaic/blob/main/components/scene-renderers/pbl-renderer.tsx"
click node_chat "https://github.com/wanggit/openmaic/blob/main/components/chat/chat-area.tsx"
click node_chat_api "https://github.com/wanggit/openmaic/blob/main/app/api/chat/route.ts"
click node_whiteboard "https://github.com/wanggit/openmaic/blob/main/lib/action/engine.ts"
click node_playback "https://github.com/wanggit/openmaic/blob/main/lib/playback/engine.ts"
click node_canvas_state "https://github.com/wanggit/openmaic/blob/main/lib/store/canvas.ts"
click node_editor "https://github.com/wanggit/openmaic/blob/main/components/edit/EditShell/EditShell.tsx"
click node_canvas_operations "https://github.com/wanggit/openmaic/blob/main/lib/hooks/use-canvas-operations.ts"
click node_export "https://github.com/wanggit/openmaic/blob/main/lib/video-export/index.ts"
click node_provider_settings "https://github.com/wanggit/openmaic/blob/main/components/settings/index.tsx"
click node_provider_api "https://github.com/wanggit/openmaic/blob/main/app/api/server-providers/route.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_workbench,node_materials,node_generation,node_generation_api toneBlue
class node_classroom_view,node_scene_renderer,node_pbl,node_chat,node_chat_api,node_whiteboard,node_playback,node_export toneAmber
class node_canvas_state,node_editor,node_canvas_operations toneMint
class node_course_store,node_persistence_api,node_provider_settings,node_provider_api toneRose
class node_learner toneIndigo
```

## Components

### Course creation

- [Course workbench](https://github.com/wanggit/openmaic/blob/main/app/workbench/new/page.tsx): `app/workbench/new/page.tsx`
- [Material intake](https://github.com/wanggit/openmaic/blob/main/app/api/materials/route.ts): `app/api/materials/route.ts`
- [Course generation](https://github.com/wanggit/openmaic/blob/main/lib/server/generation/run/engine.ts): `lib/server/generation/run/engine.ts`
- [Generation APIs](https://github.com/wanggit/openmaic/blob/main/app/api/generation-runs/route.ts): `app/api/generation-runs/route.ts`

### Classroom experience

- [Classroom viewer](https://github.com/wanggit/openmaic/blob/main/app/classroom/%5Bid%5D/page.tsx): `app/classroom/[id]/page.tsx`
- [Scene renderer](https://github.com/wanggit/openmaic/blob/main/components/stage/scene-renderer.tsx): `components/stage/scene-renderer.tsx`
- [PBL experience](https://github.com/wanggit/openmaic/blob/main/components/scene-renderers/pbl-renderer.tsx): `components/scene-renderers/pbl-renderer.tsx`
- [Agent discussion](https://github.com/wanggit/openmaic/blob/main/components/chat/chat-area.tsx): `components/chat/chat-area.tsx`
- [Chat API](https://github.com/wanggit/openmaic/blob/main/app/api/chat/route.ts): `app/api/chat/route.ts`
- [Whiteboard actions](https://github.com/wanggit/openmaic/blob/main/lib/action/engine.ts): `lib/action/engine.ts`
- [Playback engine](https://github.com/wanggit/openmaic/blob/main/lib/playback/engine.ts): `lib/playback/engine.ts`
- [Classroom export](https://github.com/wanggit/openmaic/blob/main/lib/video-export/index.ts): `lib/video-export/index.ts`

### Editing and playback

- [Canvas state](https://github.com/wanggit/openmaic/blob/main/lib/store/canvas.ts): `lib/store/canvas.ts`
- [Course editor](https://github.com/wanggit/openmaic/blob/main/components/edit/EditShell/EditShell.tsx): `components/edit/EditShell/EditShell.tsx`
- [Canvas operations](https://github.com/wanggit/openmaic/blob/main/lib/hooks/use-canvas-operations.ts): `lib/hooks/use-canvas-operations.ts`

### Platform services

- [Course persistence](https://github.com/wanggit/openmaic/blob/main/lib/document-store/index.ts): `lib/document-store/index.ts`
- [Persistence API](https://github.com/wanggit/openmaic/blob/main/app/api/persistence/%5B...path%5D/route.ts): `app/api/persistence/[...path]/route.ts`
- [Model settings](https://github.com/wanggit/openmaic/blob/main/components/settings/index.tsx): `components/settings/index.tsx`
- [Provider APIs](https://github.com/wanggit/openmaic/blob/main/app/api/server-providers/route.ts): `app/api/server-providers/route.ts`

### Other components

- **Learner**

## Connections

- Learner → Course workbench: starts lesson (evidence: `README.md`)
- Course workbench → Material intake: attaches materials (evidence: `README.md`)
- Course workbench → Generation APIs: requests generation (evidence: `README.md`)
- Generation APIs → Course generation: runs pipeline
- Course generation → Course persistence: persists course (evidence: `lib/server/generation/run/engine.ts`)
- Material intake → Course persistence: stores materials (evidence: `app/api/materials/route.ts`)
- Learner → Classroom viewer: opens course (evidence: `README.md`)
- Classroom viewer → Scene renderer: renders scenes
- Scene renderer → PBL experience: renders PBL
- Learner → Agent discussion: joins discussion (evidence: `README.md`)
- Agent discussion → Chat API: sends messages
- Playback engine → Whiteboard actions: executes actions (evidence: `lib/playback/engine.ts`)
- Whiteboard actions → Canvas state: updates state (evidence: `lib/action/engine.ts`)
- Learner → Course editor: edits course (evidence: `README.md`)
- Course editor → Canvas operations: uses operations
- Canvas operations → Canvas state: updates canvas (evidence: `lib/hooks/use-canvas-operations.ts`)
- Learner → Classroom export: exports classroom (evidence: `README.md`)
- Model settings → Provider APIs: configures providers
- Persistence API → Course persistence: accesses documents (evidence: `app/api/persistence/[...path]/route.ts`)
