# olive644/olena architecture

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

- Interactive diagram: https://gitdiagram.com/olive644/olena
- Repository: https://github.com/olive644/olena

## Overview

OlenaStudy is a student study and routine app: learners enter a workspace, then use planning, notebooks, focus and practice activities; selected progress can sync through Firebase. The graph preserves the documented math-practice, room, notebook-sharing, social-profile, listening-voice and Helena capabilities. Source excerpts confirm app routing, workspace/domain dependencies, math assessment, room persistence and Helena’s disconnected contract; other documented branches are represented without claiming unsampled implementation details.

Main entry points: [`src/app.tsx`](https://github.com/olive644/olena/blob/main/src/app.tsx) (App shell), [`src/domain/math-challenge-engine.ts`](https://github.com/olive644/olena/blob/main/src/domain/math-challenge-engine.ts) (Math challenge engine), [`src/domain/workspace.ts`](https://github.com/olive644/olena/blob/main/src/domain/workspace.ts) (Workspace model), [`src/components/listening-quiz.tsx`](https://github.com/olive644/olena/blob/main/src/components/listening-quiz.tsx) (Listening quiz voice)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Study workspace"]
  node_application["App shell<br/>[app.tsx]"]
  node_planner["Agenda and focus<br/>[planner-view.tsx]"]
  node_notebooks["Notebook workspace<br/>[notes-view.tsx]"]
  node_workspace["Workspace model<br/>[workspace.ts]"]
  node_localdata[("Local workspace data<br/>[local-workspace.ts]")]
end

subgraph group_practice["Learning activities"]
  node_practiceview["Practice activities<br/>[learn-view.tsx]"]
  node_mathbank[("Math challenge bank")]
  node_mathengine["Math challenge engine"]
  node_mathprogress["Math progress"]
  node_bingo["Number bingo<br/>[number-bingo.ts]"]
  node_helena["Helena chat<br/>[helena-chat.tsx]"]
  node_listening["Listening quiz voice<br/>[listening-quiz.tsx]"]
  node_adaptive_math["Adaptive math<br/>[adaptive-math.ts]"]
end

subgraph group_collaboration["Sharing and social"]
  node_roomui["Room experience<br/>[local-room.tsx]"]
  node_roomdomain["Room state and rules<br/>[local-room.ts]"]
  node_notecollab["Notebook sharing"]
  node_social["Profiles and social"]
end

subgraph group_services["Backend services"]
  node_cloudsync["Cloud sync<br/>[use-cloud-sync.ts]"]
  node_roomapi["Room API"]
  node_kv[("Key-value store<br/>[kv-store.ts]")]
  node_helenaapi["Helena client<br/>[helena-client.ts]"]
  node_helena_contract["Helena contract<br/>[helena-contract.ts]"]
end

subgraph group_voice["Speech services"]
  node_speechapi["Speech endpoint<br/>[speech.ts]"]
end

node_learner(("Student"))
node_firebase[("Firebase")]
node_cloudflare{{"Cloudflare TTS"}}
node_devicevoice["Device voice"]

node_learner -->|"opens"| node_application
node_application -->|"routes to"| node_planner
node_application -->|"uses"| node_workspace
node_learner -->|"uses"| node_notebooks
node_workspace -.->|"uses"| node_localdata
node_workspace -.->|"syncs through"| node_cloudsync
node_cloudsync -->|"syncs with"| node_firebase
node_learner -->|"practices"| node_practiceview
node_practiceview -.->|"runs"| node_mathengine
node_mathengine -->|"selects questions"| node_mathbank
node_mathengine -->|"assesses progress"| node_mathprogress
node_mathengine -->|"assesses answers"| node_adaptive_math
node_learner -->|"joins room"| node_roomui
node_roomui -.->|"requests room actions"| node_roomapi
node_roomapi -->|"updates state"| node_roomdomain
node_roomapi -->|"reads and writes"| node_kv
node_roomdomain -->|"uses rules"| node_bingo
node_learner -->|"shares notebooks"| node_notecollab
node_learner -.->|"uses profiles"| node_social
node_application -->|"renders chat"| node_helena
node_helena -->|"sends requests"| node_helenaapi
node_helenaapi -->|"uses contract"| node_helena_contract
node_learner -->|"takes quiz"| node_listening
node_listening -.->|"requests speech"| node_speechapi
node_speechapi -->|"synthesizes with"| node_cloudflare
node_listening -->|"falls back to"| node_devicevoice

click node_application "https://github.com/olive644/olena/blob/main/src/app.tsx"
click node_planner "https://github.com/olive644/olena/blob/main/src/views/planner-view.tsx"
click node_notebooks "https://github.com/olive644/olena/blob/main/src/views/notes-view.tsx"
click node_workspace "https://github.com/olive644/olena/blob/main/src/domain/workspace.ts"
click node_localdata "https://github.com/olive644/olena/blob/main/src/data/local-workspace.ts"
click node_cloudsync "https://github.com/olive644/olena/blob/main/src/hooks/use-cloud-sync.ts"
click node_practiceview "https://github.com/olive644/olena/blob/main/src/views/learn-view.tsx"
click node_mathbank "https://github.com/olive644/olena/blob/main/src/data/math-challenge-bank.ts"
click node_mathengine "https://github.com/olive644/olena/blob/main/src/domain/math-challenge-engine.ts"
click node_mathprogress "https://github.com/olive644/olena/blob/main/src/domain/math-challenge-progress.ts"
click node_bingo "https://github.com/olive644/olena/blob/main/src/domain/number-bingo.ts"
click node_roomui "https://github.com/olive644/olena/blob/main/src/components/local-room.tsx"
click node_roomdomain "https://github.com/olive644/olena/blob/main/src/domain/local-room.ts"
click node_roomapi "https://github.com/olive644/olena/blob/main/src/backend/local-room-handler.ts"
click node_kv "https://github.com/olive644/olena/blob/main/src/backend/kv-store.ts"
click node_notecollab "https://github.com/olive644/olena/blob/main/src/backend/notebook-collab-handler.ts"
click node_social "https://github.com/olive644/olena/blob/main/src/backend/profile-social-handler.ts"
click node_helena "https://github.com/olive644/olena/blob/main/src/components/helena-chat.tsx"
click node_helenaapi "https://github.com/olive644/olena/blob/main/src/data/helena-client.ts"
click node_helena_contract "https://github.com/olive644/olena/blob/main/src/ai/helena-contract.ts"
click node_listening "https://github.com/olive644/olena/blob/main/src/components/listening-quiz.tsx"
click node_speechapi "https://github.com/olive644/olena/blob/main/api/speech.ts"
click node_adaptive_math "https://github.com/olive644/olena/blob/main/src/domain/adaptive-math.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_application,node_planner,node_notebooks,node_workspace,node_localdata toneBlue
class node_practiceview,node_mathbank,node_mathengine,node_mathprogress,node_bingo,node_helena,node_listening,node_adaptive_math,node_firebase toneAmber
class node_roomui,node_roomdomain,node_notecollab,node_social toneMint
class node_cloudsync,node_roomapi,node_kv,node_helenaapi,node_helena_contract toneRose
class node_speechapi,node_learner,node_cloudflare,node_devicevoice toneIndigo
```

## Components

### Study workspace

- [App shell](https://github.com/olive644/olena/blob/main/src/app.tsx): `src/app.tsx`
- [Agenda and focus](https://github.com/olive644/olena/blob/main/src/views/planner-view.tsx): `src/views/planner-view.tsx`
- [Notebook workspace](https://github.com/olive644/olena/blob/main/src/views/notes-view.tsx): `src/views/notes-view.tsx`
- [Workspace model](https://github.com/olive644/olena/blob/main/src/domain/workspace.ts): `src/domain/workspace.ts`
- [Local workspace data](https://github.com/olive644/olena/blob/main/src/data/local-workspace.ts): `src/data/local-workspace.ts`

### Learning activities

- [Practice activities](https://github.com/olive644/olena/blob/main/src/views/learn-view.tsx): `src/views/learn-view.tsx`
- [Math challenge bank](https://github.com/olive644/olena/blob/main/src/data/math-challenge-bank.ts): `src/data/math-challenge-bank.ts`
- [Math challenge engine](https://github.com/olive644/olena/blob/main/src/domain/math-challenge-engine.ts): `src/domain/math-challenge-engine.ts`
- [Math progress](https://github.com/olive644/olena/blob/main/src/domain/math-challenge-progress.ts): `src/domain/math-challenge-progress.ts`
- [Number bingo](https://github.com/olive644/olena/blob/main/src/domain/number-bingo.ts): `src/domain/number-bingo.ts`
- [Helena chat](https://github.com/olive644/olena/blob/main/src/components/helena-chat.tsx): `src/components/helena-chat.tsx`
- [Listening quiz voice](https://github.com/olive644/olena/blob/main/src/components/listening-quiz.tsx): `src/components/listening-quiz.tsx`
- [Adaptive math](https://github.com/olive644/olena/blob/main/src/domain/adaptive-math.ts): `src/domain/adaptive-math.ts`

### Sharing and social

- [Room experience](https://github.com/olive644/olena/blob/main/src/components/local-room.tsx): `src/components/local-room.tsx`
- [Room state and rules](https://github.com/olive644/olena/blob/main/src/domain/local-room.ts): `src/domain/local-room.ts`
- [Notebook sharing](https://github.com/olive644/olena/blob/main/src/backend/notebook-collab-handler.ts): `src/backend/notebook-collab-handler.ts`
- [Profiles and social](https://github.com/olive644/olena/blob/main/src/backend/profile-social-handler.ts): `src/backend/profile-social-handler.ts`

### Backend services

- [Cloud sync](https://github.com/olive644/olena/blob/main/src/hooks/use-cloud-sync.ts): `src/hooks/use-cloud-sync.ts`
- [Room API](https://github.com/olive644/olena/blob/main/src/backend/local-room-handler.ts): `src/backend/local-room-handler.ts`
- [Key-value store](https://github.com/olive644/olena/blob/main/src/backend/kv-store.ts): `src/backend/kv-store.ts`
- [Helena client](https://github.com/olive644/olena/blob/main/src/data/helena-client.ts): `src/data/helena-client.ts`
- [Helena contract](https://github.com/olive644/olena/blob/main/src/ai/helena-contract.ts): `src/ai/helena-contract.ts`

### Speech services

- [Speech endpoint](https://github.com/olive644/olena/blob/main/api/speech.ts): `api/speech.ts`

### Other components

- **Student**
- **Firebase**
- **Cloudflare TTS**
- **Device voice**

## Connections

- Student → App shell: opens
- App shell → Agenda and focus: routes to (evidence: `src/app.tsx`)
- App shell → Workspace model: uses (evidence: `src/app.tsx`)
- Student → Notebook workspace: uses
- Workspace model → Local workspace data: uses (evidence: `src/domain/workspace.ts`)
- Workspace model → Cloud sync: syncs through
- Cloud sync → Firebase: syncs with
- Student → Practice activities: practices
- Practice activities → Math challenge engine: runs
- Math challenge engine → Math challenge bank: selects questions (evidence: `src/domain/math-challenge-engine.ts`)
- Math challenge engine → Math progress: assesses progress (evidence: `src/domain/math-challenge-engine.ts`)
- Math challenge engine → Adaptive math: assesses answers (evidence: `src/domain/math-challenge-engine.ts`)
- Student → Room experience: joins room
- Room experience → Room API: requests room actions
- Room API → Room state and rules: updates state (evidence: `src/backend/local-room-handler.ts`)
- Room API → Key-value store: reads and writes (evidence: `src/backend/local-room-handler.ts`)
- Room state and rules → Number bingo: uses rules (evidence: `src/domain/local-room.ts`)
- Student → Notebook sharing: shares notebooks
- Student → Profiles and social: uses profiles
- App shell → Helena chat: renders chat (evidence: `src/app.tsx`)
- Helena chat → Helena client: sends requests (evidence: `src/components/helena-chat.tsx`)
- Helena client → Helena contract: uses contract (evidence: `src/data/helena-client.ts`)
- Student → Listening quiz voice: takes quiz
- Listening quiz voice → Speech endpoint: requests speech
- Speech endpoint → Cloudflare TTS: synthesizes with
- Listening quiz voice → Device voice: falls back to
