# cahlr/oatutor architecture

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

- Interactive diagram: https://gitdiagram.com/cahlr/oatutor
- Repository: https://github.com/cahlr/oatutor
- Video tour (about a minute): https://gitdiagram.com/cahlr/oatutor/video

## Overview

OATutor is a React-based adaptive tutoring system. Students enter a course, navigate lessons and problems, submit answers, and receive scaffolding; the platform also tracks progress and can log activity. The repository includes optional LTI course integration, AI tutoring, and speech support alongside its core adaptive-learning capabilities. The map preserves these documented branches. Some subsystems are represented by their exact directory because their implementation was not sampled; edges are limited to relationships visible in excerpts, the source index, or README.

Main entry points: [`src/App.js`](https://github.com/cahlr/oatutor/blob/main/src/App.js) (Application shell), [`src/platform-logic/Platform.js`](https://github.com/cahlr/oatutor/blob/main/src/platform-logic/Platform.js) (Lesson platform), [`aws/aiAgentGeneration/index.mjs`](https://github.com/cahlr/oatutor/blob/main/aws/aiAgentGeneration/index.mjs) (AI agent endpoint), [`aws/lti-middleware/index.js`](https://github.com/cahlr/oatutor/blob/main/aws/lti-middleware/index.js) (LTI middleware)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Tutoring experience"]
  node_app["Application shell<br/>[App.js]"]
  node_platform["Lesson platform<br/>[Platform.js]"]
  node_problems["Problem interaction<br/>[ProblemInput.js]"]
  node_toc["Course navigation<br/>[tableOfContents.js]"]
end

subgraph group_learning["Learning services"]
  node_config["Course plans<br/>[config.js]"]
  node_adaptivity["Adaptive selection"]
  node_bkt["Mastery model<br/>[BKT-brain.js]"]
  node_progress[("Browser progress<br/>[browserStorage.js]")]
end

subgraph group_integrations["External integrations"]
  node_firebase["Activity logging<br/>[Firebase.js]"]
  node_lti["LTI middleware<br/>[index.js]"]
end

subgraph group_ai["AI tutoring"]
  node_aihttp["AI agent endpoint<br/>[index.mjs]"]
  node_agent["Agent logic<br/>[agent-logic.mjs]"]
  node_memory["Conversation memory"]
  node_doccontext["Document context"]
  node_docids["Document ID utilities"]
  node_hintgen["Hint generation<br/>[index.mjs]"]
end

subgraph group_speech["Speech support"]
  node_tts["Speech processing"]
  node_ttsplayer["Speech playback<br/>[ttsPlayer.js]"]
end

node_student(("Student"))
node_lms(("Learning platform"))
node_openai["OpenAI service"]
node_lambda["TTS endpoint"]

node_student -->|"uses"| node_app
node_app -->|"renders"| node_platform
node_app -->|"creates"| node_firebase
node_app -->|"creates"| node_progress
node_platform -->|"renders"| node_problems
node_platform -->|"renders"| node_toc
node_platform -->|"reads plans"| node_config
node_platform -->|"saves progress"| node_progress
node_student -->|"submits answers"| node_problems
node_lti -->|"integrates"| node_lms
node_app -.->|"launches through"| node_lti
node_aihttp -->|"calls"| node_agent
node_aihttp -->|"resolves prompts"| node_docids
node_doccontext -->|"validates keys"| node_docids
node_aihttp -->|"uses"| node_openai
node_agent -->|"generates responses"| node_openai
node_student -.->|"requests hints"| node_hintgen
node_tts -.->|"prepares speech"| node_lambda
node_app -.->|"plays speech"| node_ttsplayer
node_ttsplayer -.->|"requests audio"| node_lambda

click node_app "https://github.com/cahlr/oatutor/blob/main/src/App.js"
click node_platform "https://github.com/cahlr/oatutor/blob/main/src/platform-logic/Platform.js"
click node_problems "https://github.com/cahlr/oatutor/blob/main/src/components/problem-input/ProblemInput.js"
click node_toc "https://github.com/cahlr/oatutor/blob/main/src/components/tableOfContents.js"
click node_config "https://github.com/cahlr/oatutor/blob/main/src/config/config.js"
click node_adaptivity "https://github.com/cahlr/oatutor/blob/main/src/models/BKT/problem-select-heuristics/defaultHeuristic.js"
click node_bkt "https://github.com/cahlr/oatutor/blob/main/src/models/BKT/BKT-brain.js"
click node_progress "https://github.com/cahlr/oatutor/blob/main/src/util/browserStorage.js"
click node_firebase "https://github.com/cahlr/oatutor/blob/main/src/components/Firebase.js"
click node_lti "https://github.com/cahlr/oatutor/blob/main/aws/lti-middleware/index.js"
click node_aihttp "https://github.com/cahlr/oatutor/blob/main/aws/aiAgentGeneration/index.mjs"
click node_agent "https://github.com/cahlr/oatutor/blob/main/aws/aiAgentGeneration/agent-logic.mjs"
click node_memory "https://github.com/cahlr/oatutor/blob/main/aws/aiAgentGeneration/conversation-memory.mjs"
click node_doccontext "https://github.com/cahlr/oatutor/blob/main/aws/aiAgentGeneration/document-context.mjs"
click node_docids "https://github.com/cahlr/oatutor/blob/main/aws/aiAgentGeneration/document-id-utils.mjs"
click node_hintgen "https://github.com/cahlr/oatutor/blob/main/aws/aiHintGeneration/index.mjs"
click node_tts "https://github.com/cahlr/oatutor/blob/main/src/math-to-speech/scripts/autoTTSProcessor.js"
click node_ttsplayer "https://github.com/cahlr/oatutor/blob/main/src/util/ttsPlayer.js"

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_platform,node_problems,node_toc toneBlue
class node_config,node_adaptivity,node_bkt,node_progress toneAmber
class node_firebase,node_lti toneMint
class node_aihttp,node_agent,node_memory,node_doccontext,node_docids,node_hintgen toneRose
class node_tts,node_ttsplayer,node_student,node_lms,node_openai,node_lambda toneIndigo
```

## Components

### Tutoring experience

- [Application shell](https://github.com/cahlr/oatutor/blob/main/src/App.js): `src/App.js`
- [Lesson platform](https://github.com/cahlr/oatutor/blob/main/src/platform-logic/Platform.js): `src/platform-logic/Platform.js`
- [Problem interaction](https://github.com/cahlr/oatutor/blob/main/src/components/problem-input/ProblemInput.js): `src/components/problem-input/ProblemInput.js`
- [Course navigation](https://github.com/cahlr/oatutor/blob/main/src/components/tableOfContents.js): `src/components/tableOfContents.js`

### Learning services

- [Course plans](https://github.com/cahlr/oatutor/blob/main/src/config/config.js): `src/config/config.js`
- [Adaptive selection](https://github.com/cahlr/oatutor/blob/main/src/models/BKT/problem-select-heuristics/defaultHeuristic.js): `src/models/BKT/problem-select-heuristics/defaultHeuristic.js`
- [Mastery model](https://github.com/cahlr/oatutor/blob/main/src/models/BKT/BKT-brain.js): `src/models/BKT/BKT-brain.js`
- [Browser progress](https://github.com/cahlr/oatutor/blob/main/src/util/browserStorage.js): `src/util/browserStorage.js`

### External integrations

- [Activity logging](https://github.com/cahlr/oatutor/blob/main/src/components/Firebase.js): `src/components/Firebase.js`
- [LTI middleware](https://github.com/cahlr/oatutor/blob/main/aws/lti-middleware/index.js): `aws/lti-middleware/index.js`

### AI tutoring

- [AI agent endpoint](https://github.com/cahlr/oatutor/blob/main/aws/aiAgentGeneration/index.mjs): `aws/aiAgentGeneration/index.mjs`
- [Agent logic](https://github.com/cahlr/oatutor/blob/main/aws/aiAgentGeneration/agent-logic.mjs): `aws/aiAgentGeneration/agent-logic.mjs`
- [Conversation memory](https://github.com/cahlr/oatutor/blob/main/aws/aiAgentGeneration/conversation-memory.mjs): `aws/aiAgentGeneration/conversation-memory.mjs`
- [Document context](https://github.com/cahlr/oatutor/blob/main/aws/aiAgentGeneration/document-context.mjs): `aws/aiAgentGeneration/document-context.mjs`
- [Document ID utilities](https://github.com/cahlr/oatutor/blob/main/aws/aiAgentGeneration/document-id-utils.mjs): `aws/aiAgentGeneration/document-id-utils.mjs`
- [Hint generation](https://github.com/cahlr/oatutor/blob/main/aws/aiHintGeneration/index.mjs): `aws/aiHintGeneration/index.mjs`

### Speech support

- [Speech processing](https://github.com/cahlr/oatutor/blob/main/src/math-to-speech/scripts/autoTTSProcessor.js): `src/math-to-speech/scripts/autoTTSProcessor.js`
- [Speech playback](https://github.com/cahlr/oatutor/blob/main/src/util/ttsPlayer.js): `src/util/ttsPlayer.js`

### Other components

- **Student**
- **Learning platform**
- **OpenAI service**
- **TTS endpoint**

## Connections

- Student → Application shell: uses (evidence: `README.md`)
- Application shell → Lesson platform: renders (evidence: `src/App.js`)
- Application shell → Activity logging: creates (evidence: `src/App.js`)
- Application shell → Browser progress: creates (evidence: `src/App.js`)
- Lesson platform → Problem interaction: renders (evidence: `src/platform-logic/Platform.js`)
- Lesson platform → Course navigation: renders (evidence: `src/platform-logic/Platform.js`)
- Lesson platform → Course plans: reads plans (evidence: `src/platform-logic/Platform.js`)
- Lesson platform → Browser progress: saves progress (evidence: `src/platform-logic/Platform.js`)
- Student → Problem interaction: submits answers (evidence: `README.md`)
- LTI middleware → Learning platform: integrates (evidence: `README.md`)
- Application shell → LTI middleware: launches through
- AI agent endpoint → Agent logic: calls (evidence: `aws/aiAgentGeneration/index.mjs`)
- AI agent endpoint → Document ID utilities: resolves prompts (evidence: `aws/aiAgentGeneration/index.mjs`)
- Document context → Document ID utilities: validates keys (evidence: `aws/aiAgentGeneration/document-context.mjs`)
- AI agent endpoint → OpenAI service: uses (evidence: `aws/aiAgentGeneration/index.mjs`)
- Agent logic → OpenAI service: generates responses (evidence: `aws/aiAgentGeneration/agent-logic.mjs`)
- Student → Hint generation: requests hints
- Speech processing → TTS endpoint: prepares speech (evidence: `README.md`)
- Application shell → Speech playback: plays speech (evidence: `README.md`)
- Speech playback → TTS endpoint: requests audio (evidence: `README.md`)
