# behnamazimi/lobyas architecture

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

## Overview

Lobyas is an invite-only learning app for field terminology and language vocabulary. The main learner flow imports or captures terms into collections, then uses ranked Read, Review, and Quiz practice; TRACE supplies the shared ranking and retention model. The product also offers optional AI stories, quizzes, and narration, plus Telegram and macOS widget study surfaces and a broad admin console. Relationships are based on README statements and the supplied source index; several route and subsystem implementations were not sampled, so uncertain links are omitted.

Main entry points: [`lib/trace/index.ts`](https://github.com/behnamazimi/lobyas/blob/main/lib/trace/index.ts) (TRACE engine), [`lib/trace-queue/repository.ts`](https://github.com/behnamazimi/lobyas/blob/main/lib/trace-queue/repository.ts) (Study queue), [`app/(private)/app/import/page.tsx`](https://github.com/behnamazimi/lobyas/blob/main/app/(private)/app/import/page.tsx) (Import terms), [`app/(private)/app/capture/page.tsx`](https://github.com/behnamazimi/lobyas/blob/main/app/(private)/app/capture/page.tsx) (Capture terms)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_learning["Learning workflow"]
  node_import["Import terms<br/>[page.tsx]"]
  node_capture["Capture terms<br/>[page.tsx]"]
  node_collections["Collections<br/>[page.tsx]"]
  node_read["Read practice<br/>[read-page.tsx]"]
  node_review["Review practice<br/>[review-page.tsx]"]
  node_quiz["Quiz practice<br/>[quiz-page.tsx]"]
end

subgraph group_ranking["TRACE and data"]
  node_trace["TRACE engine<br/>[index.ts]"]
  node_queue["Study queue<br/>[repository.ts]"]
  node_database[("Supabase data<br/>[database.types.ts]")]
end

subgraph group_ai["AI and narration"]
  node_ai["AI features<br/>[actions.ts]"]
  node_narration["Narration API<br/>[route.ts]"]
  node_speech["Speech generation<br/>[audio.ts]"]
end

subgraph group_surfaces["Other surfaces"]
  node_telegram["Telegram study"]
  node_widget["Desktop widget<br/>[index.jsx]"]
end

subgraph group_operations["Administration"]
  node_admin["Admin console<br/>[page.tsx]"]
  node_admin_ai["AI administration<br/>[actions.ts]"]
end

node_learner(("Learner"))
node_supabase_auth[("Supabase Auth")]
node_telegram_service(("Telegram"))

node_learner -->|"imports terms"| node_import
node_learner -->|"captures terms"| node_capture
node_import -->|"adds to"| node_collections
node_capture -.->|"adds to"| node_collections
node_learner -->|"practices with"| node_read
node_learner -->|"practices with"| node_review
node_learner -->|"checks learning"| node_quiz
node_read -->|"requests ranked terms"| node_queue
node_review -->|"requests ranked terms"| node_queue
node_quiz -->|"requests ranked terms"| node_queue
node_queue -->|"ranks candidates"| node_trace
node_trace -.->|"uses study state"| node_database
node_learner -->|"requests optional AI"| node_ai
node_learner -->|"requests audio"| node_narration
node_narration -->|"loads or generates"| node_speech
node_telegram_service -.->|"delivers study flow"| node_telegram
node_telegram -->|"shares ranking"| node_trace
node_widget -->|"shares ranking"| node_trace
node_admin -.->|"manages AI access"| node_admin_ai
node_supabase_auth -.->|"authenticates"| node_learner

click node_import "https://github.com/behnamazimi/lobyas/blob/main/app/(private)/app/import/page.tsx"
click node_capture "https://github.com/behnamazimi/lobyas/blob/main/app/(private)/app/capture/page.tsx"
click node_collections "https://github.com/behnamazimi/lobyas/blob/main/app/(private)/app/library/page.tsx"
click node_read "https://github.com/behnamazimi/lobyas/blob/main/components/read/read-page.tsx"
click node_review "https://github.com/behnamazimi/lobyas/blob/main/components/review/review-page.tsx"
click node_quiz "https://github.com/behnamazimi/lobyas/blob/main/components/quiz/quiz-page.tsx"
click node_trace "https://github.com/behnamazimi/lobyas/blob/main/lib/trace/index.ts"
click node_queue "https://github.com/behnamazimi/lobyas/blob/main/lib/trace-queue/repository.ts"
click node_database "https://github.com/behnamazimi/lobyas/blob/main/lib/supabase/database.types.ts"
click node_ai "https://github.com/behnamazimi/lobyas/blob/main/app/(private)/app/actions.ts"
click node_narration "https://github.com/behnamazimi/lobyas/blob/main/app/api/narration/%5BtermId%5D/route.ts"
click node_speech "https://github.com/behnamazimi/lobyas/blob/main/lib/ai/speech/audio.ts"
click node_telegram "https://github.com/behnamazimi/lobyas/blob/main/lib/telegram/review-session-flow.ts"
click node_widget "https://github.com/behnamazimi/lobyas/blob/main/widget/lobyas.widget/index.jsx"
click node_admin "https://github.com/behnamazimi/lobyas/blob/main/app/(private)/admin/page.tsx"
click node_admin_ai "https://github.com/behnamazimi/lobyas/blob/main/app/(private)/admin/ai/narration/actions.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_import,node_capture,node_collections,node_read,node_review,node_quiz toneBlue
class node_trace,node_queue,node_database,node_supabase_auth toneAmber
class node_ai,node_narration,node_speech toneMint
class node_telegram,node_widget toneRose
class node_admin,node_admin_ai,node_learner,node_telegram_service toneIndigo
```

## Components

### Learning workflow

- [Import terms](https://github.com/behnamazimi/lobyas/blob/main/app/(private)/app/import/page.tsx): `app/(private)/app/import/page.tsx`
- [Capture terms](https://github.com/behnamazimi/lobyas/blob/main/app/(private)/app/capture/page.tsx): `app/(private)/app/capture/page.tsx`
- [Collections](https://github.com/behnamazimi/lobyas/blob/main/app/(private)/app/library/page.tsx): `app/(private)/app/library/page.tsx`
- [Read practice](https://github.com/behnamazimi/lobyas/blob/main/components/read/read-page.tsx): `components/read/read-page.tsx`
- [Review practice](https://github.com/behnamazimi/lobyas/blob/main/components/review/review-page.tsx): `components/review/review-page.tsx`
- [Quiz practice](https://github.com/behnamazimi/lobyas/blob/main/components/quiz/quiz-page.tsx): `components/quiz/quiz-page.tsx`

### TRACE and data

- [TRACE engine](https://github.com/behnamazimi/lobyas/blob/main/lib/trace/index.ts): `lib/trace/index.ts`
- [Study queue](https://github.com/behnamazimi/lobyas/blob/main/lib/trace-queue/repository.ts): `lib/trace-queue/repository.ts`
- [Supabase data](https://github.com/behnamazimi/lobyas/blob/main/lib/supabase/database.types.ts): `lib/supabase/database.types.ts`

### AI and narration

- [AI features](https://github.com/behnamazimi/lobyas/blob/main/app/(private)/app/actions.ts): `app/(private)/app/actions.ts`
- [Narration API](https://github.com/behnamazimi/lobyas/blob/main/app/api/narration/%5BtermId%5D/route.ts): `app/api/narration/[termId]/route.ts`
- [Speech generation](https://github.com/behnamazimi/lobyas/blob/main/lib/ai/speech/audio.ts): `lib/ai/speech/audio.ts`

### Other surfaces

- [Telegram study](https://github.com/behnamazimi/lobyas/blob/main/lib/telegram/review-session-flow.ts): `lib/telegram/review-session-flow.ts`
- [Desktop widget](https://github.com/behnamazimi/lobyas/blob/main/widget/lobyas.widget/index.jsx): `widget/lobyas.widget/index.jsx`

### Administration

- [Admin console](https://github.com/behnamazimi/lobyas/blob/main/app/(private)/admin/page.tsx): `app/(private)/admin/page.tsx`
- [AI administration](https://github.com/behnamazimi/lobyas/blob/main/app/(private)/admin/ai/narration/actions.ts): `app/(private)/admin/ai/narration/actions.ts`

### Other components

- **Learner**
- **Supabase Auth**
- **Telegram**

## Connections

- Learner → Import terms: imports terms (evidence: `README.md`)
- Learner → Capture terms: captures terms (evidence: `README.md`)
- Import terms → Collections: adds to (evidence: `README.md`)
- Capture terms → Collections: adds to
- Learner → Read practice: practices with (evidence: `README.md`)
- Learner → Review practice: practices with (evidence: `README.md`)
- Learner → Quiz practice: checks learning (evidence: `README.md`)
- Read practice → Study queue: requests ranked terms (evidence: `README.md`)
- Review practice → Study queue: requests ranked terms (evidence: `README.md`)
- Quiz practice → Study queue: requests ranked terms (evidence: `README.md`)
- Study queue → TRACE engine: ranks candidates (evidence: `lib/trace-queue/repository.ts`)
- TRACE engine → Supabase data: uses study state
- Learner → AI features: requests optional AI (evidence: `README.md`)
- Learner → Narration API: requests audio (evidence: `app/api/narration/[termId]/route.ts`)
- Narration API → Speech generation: loads or generates (evidence: `app/api/narration/[termId]/route.ts`)
- Telegram → Telegram study: delivers study flow
- Telegram study → TRACE engine: shares ranking (evidence: `README.md`)
- Desktop widget → TRACE engine: shares ranking (evidence: `README.md`)
- Admin console → AI administration: manages AI access
- Supabase Auth → Learner: authenticates
