# bob798/speakeasy architecture

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

- Interactive diagram: https://gitdiagram.com/bob798/speakeasy
- Repository: https://github.com/bob798/speakeasy

## Overview

Speakeasy is an AI English tutor that personalizes practice across sessions. The main workflow is: a learner chats with Alex, the backend generates a response, then analyzes the conversation and updates review and memory so later chats can use what it has learned. Separate product branches support article practice, translation, vocabulary, explanations, and voice input/output. The graph combines README-documented capabilities with relationships visible in the sampled sources and SOURCE INDEX; unsampled service internals are represented only where their role is documented or named.

Main entry points: [`main.py`](https://github.com/bob798/speakeasy/blob/main/main.py) (FastAPI app), [`app/routers/articles.py`](https://github.com/bob798/speakeasy/blob/main/app/routers/articles.py) (Article routes), [`app/models/db.py`](https://github.com/bob798/speakeasy/blob/main/app/models/db.py) (Data models), [`frontend/src/App.vue`](https://github.com/bob798/speakeasy/blob/main/frontend/src/App.vue) (Web app)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Learner experience"]
  node_web["Web app<br/>[App.vue]"]
end

subgraph group_api["Application API"]
  node_entry["FastAPI app<br/>[main.py]"]
  node_chat_api["Chat routes<br/>[chat.py]"]
  node_auth_api["Auth routes<br/>[auth.py]"]
  node_review_api["Review routes<br/>[review.py]"]
  node_memory_api["Memory routes<br/>[memory.py]"]
  node_articles_api["Article routes<br/>[articles.py]"]
  node_translate_api["Translation routes<br/>[translate.py]"]
end

subgraph group_coaching["Personalized coaching"]
  node_account["Account service<br/>[auth_service.py]"]
  node_chat_service["Conversation service<br/>[chat_service.py]"]
  node_review_service["Conversation review<br/>[review_service.py]"]
  node_memory_service["Learner memory<br/>[memory_service.py]"]
  node_profile["Learner profile<br/>[profile_service.py]"]
end

subgraph group_learning["Study tools"]
  node_subtitle["Subtitle import"]
  node_practice["Article practice"]
  node_vocab["Vocabulary service<br/>[vocab_service.py]"]
  node_explain["Explanation service<br/>[explain_service.py]"]
  node_voice["Speech services<br/>[stt_service.py]"]
  node_tts["Speech synthesis<br/>[tts_service.py]"]
end

subgraph group_platform["Shared platform"]
  node_model_client["Model client<br/>[model_client.py]"]
  node_database[("SQLite database<br/>[database.py]")]
  node_models["Data models<br/>[db.py]"]
  node_config["Runtime config<br/>[config.py]"]
end

node_learner(("Learner"))
node_ai_provider["LLM providers"]

node_learner -->|"uses"| node_web
node_web -->|"calls API"| node_entry
node_entry -->|"registers"| node_chat_api
node_entry -->|"registers"| node_auth_api
node_entry -->|"registers"| node_review_api
node_entry -->|"registers"| node_articles_api
node_entry -->|"registers"| node_translate_api
node_auth_api -->|"delegates to"| node_account
node_account -->|"reads and writes"| node_models
node_chat_api -->|"calls"| node_chat_service
node_chat_api -->|"requests analysis"| node_review_service
node_chat_api -->|"updates memory"| node_memory_service
node_review_service -->|"generates review"| node_model_client
node_review_service -->|"stores review"| node_models
node_review_api -->|"reads and rates"| node_review_service
node_memory_api -->|"reads profile"| node_profile
node_memory_service -.->|"persists memory"| node_models
node_profile -.->|"persists profile"| node_models
node_model_client -->|"sends prompts"| node_ai_provider
node_articles_api -->|"imports subtitles"| node_subtitle
node_articles_api -->|"serves practice"| node_practice
node_articles_api -->|"requests explanations"| node_explain
node_articles_api -->|"requests audio"| node_tts
node_articles_api -->|"saves vocabulary"| node_vocab
node_translate_api -.->|"supports vocabulary"| node_vocab
node_explain -->|"generates explanations"| node_model_client
node_voice -.->|"transcribes speech"| node_ai_provider
node_web -.->|"submits speech"| node_voice
node_web -.->|"plays generated speech"| node_tts
node_database -->|"creates tables"| node_models
node_database -->|"loads database URL"| node_config
node_entry -->|"initializes storage"| node_database
node_model_client -->|"reads model settings"| node_config

click node_web "https://github.com/bob798/speakeasy/blob/main/frontend/src/App.vue"
click node_entry "https://github.com/bob798/speakeasy/blob/main/main.py"
click node_chat_api "https://github.com/bob798/speakeasy/blob/main/app/routers/chat.py"
click node_auth_api "https://github.com/bob798/speakeasy/blob/main/app/routers/auth.py"
click node_account "https://github.com/bob798/speakeasy/blob/main/app/services/auth_service.py"
click node_chat_service "https://github.com/bob798/speakeasy/blob/main/app/services/chat_service.py"
click node_model_client "https://github.com/bob798/speakeasy/blob/main/app/services/model_client.py"
click node_review_api "https://github.com/bob798/speakeasy/blob/main/app/routers/review.py"
click node_review_service "https://github.com/bob798/speakeasy/blob/main/app/services/review_service.py"
click node_memory_api "https://github.com/bob798/speakeasy/blob/main/app/routers/memory.py"
click node_memory_service "https://github.com/bob798/speakeasy/blob/main/app/services/memory_service.py"
click node_profile "https://github.com/bob798/speakeasy/blob/main/app/services/profile_service.py"
click node_articles_api "https://github.com/bob798/speakeasy/blob/main/app/routers/articles.py"
click node_subtitle "https://github.com/bob798/speakeasy/blob/main/app/services/subtitle_service.py"
click node_practice "https://github.com/bob798/speakeasy/blob/main/app/services/practice_service.py"
click node_translate_api "https://github.com/bob798/speakeasy/blob/main/app/routers/translate.py"
click node_vocab "https://github.com/bob798/speakeasy/blob/main/app/services/vocab_service.py"
click node_explain "https://github.com/bob798/speakeasy/blob/main/app/services/explain_service.py"
click node_voice "https://github.com/bob798/speakeasy/blob/main/app/services/stt_service.py"
click node_tts "https://github.com/bob798/speakeasy/blob/main/app/services/tts_service.py"
click node_database "https://github.com/bob798/speakeasy/blob/main/app/database.py"
click node_models "https://github.com/bob798/speakeasy/blob/main/app/models/db.py"
click node_config "https://github.com/bob798/speakeasy/blob/main/app/config.py"

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_web toneBlue
class node_entry,node_chat_api,node_auth_api,node_review_api,node_memory_api,node_articles_api,node_translate_api toneAmber
class node_account,node_chat_service,node_review_service,node_memory_service,node_profile toneMint
class node_subtitle,node_practice,node_vocab,node_explain,node_voice,node_tts toneRose
class node_model_client,node_database,node_models,node_config,node_learner,node_ai_provider toneIndigo
```

## Components

### Learner experience

- [Web app](https://github.com/bob798/speakeasy/blob/main/frontend/src/App.vue): `frontend/src/App.vue`

### Application API

- [FastAPI app](https://github.com/bob798/speakeasy/blob/main/main.py): `main.py`
- [Chat routes](https://github.com/bob798/speakeasy/blob/main/app/routers/chat.py): `app/routers/chat.py`
- [Auth routes](https://github.com/bob798/speakeasy/blob/main/app/routers/auth.py): `app/routers/auth.py`
- [Review routes](https://github.com/bob798/speakeasy/blob/main/app/routers/review.py): `app/routers/review.py`
- [Memory routes](https://github.com/bob798/speakeasy/blob/main/app/routers/memory.py): `app/routers/memory.py`
- [Article routes](https://github.com/bob798/speakeasy/blob/main/app/routers/articles.py): `app/routers/articles.py`
- [Translation routes](https://github.com/bob798/speakeasy/blob/main/app/routers/translate.py): `app/routers/translate.py`

### Personalized coaching

- [Account service](https://github.com/bob798/speakeasy/blob/main/app/services/auth_service.py): `app/services/auth_service.py`
- [Conversation service](https://github.com/bob798/speakeasy/blob/main/app/services/chat_service.py): `app/services/chat_service.py`
- [Conversation review](https://github.com/bob798/speakeasy/blob/main/app/services/review_service.py): `app/services/review_service.py`
- [Learner memory](https://github.com/bob798/speakeasy/blob/main/app/services/memory_service.py): `app/services/memory_service.py`
- [Learner profile](https://github.com/bob798/speakeasy/blob/main/app/services/profile_service.py): `app/services/profile_service.py`

### Study tools

- [Subtitle import](https://github.com/bob798/speakeasy/blob/main/app/services/subtitle_service.py): `app/services/subtitle_service.py`
- [Article practice](https://github.com/bob798/speakeasy/blob/main/app/services/practice_service.py): `app/services/practice_service.py`
- [Vocabulary service](https://github.com/bob798/speakeasy/blob/main/app/services/vocab_service.py): `app/services/vocab_service.py`
- [Explanation service](https://github.com/bob798/speakeasy/blob/main/app/services/explain_service.py): `app/services/explain_service.py`
- [Speech services](https://github.com/bob798/speakeasy/blob/main/app/services/stt_service.py): `app/services/stt_service.py`
- [Speech synthesis](https://github.com/bob798/speakeasy/blob/main/app/services/tts_service.py): `app/services/tts_service.py`

### Shared platform

- [Model client](https://github.com/bob798/speakeasy/blob/main/app/services/model_client.py): `app/services/model_client.py`
- [SQLite database](https://github.com/bob798/speakeasy/blob/main/app/database.py): `app/database.py`
- [Data models](https://github.com/bob798/speakeasy/blob/main/app/models/db.py): `app/models/db.py`
- [Runtime config](https://github.com/bob798/speakeasy/blob/main/app/config.py): `app/config.py`

### Other components

- **Learner**
- **LLM providers**

## Connections

- Learner → Web app: uses (evidence: `README.md`)
- Web app → FastAPI app: calls API (evidence: `README.md`)
- FastAPI app → Chat routes: registers (evidence: `main.py`)
- FastAPI app → Auth routes: registers (evidence: `main.py`)
- FastAPI app → Review routes: registers (evidence: `main.py`)
- FastAPI app → Article routes: registers (evidence: `main.py`)
- FastAPI app → Translation routes: registers (evidence: `main.py`)
- Auth routes → Account service: delegates to (evidence: `app/routers/auth.py`)
- Account service → Data models: reads and writes (evidence: `app/services/auth_service.py`)
- Chat routes → Conversation service: calls (evidence: `app/routers/chat.py`)
- Chat routes → Conversation review: requests analysis (evidence: `app/routers/chat.py`)
- Chat routes → Learner memory: updates memory (evidence: `app/routers/chat.py`)
- Conversation review → Model client: generates review (evidence: `app/services/review_service.py`)
- Conversation review → Data models: stores review (evidence: `app/services/review_service.py`)
- Review routes → Conversation review: reads and rates (evidence: `app/routers/review.py`)
- Memory routes → Learner profile: reads profile (evidence: `app/routers/memory.py`)
- Learner memory → Data models: persists memory
- Learner profile → Data models: persists profile
- Model client → LLM providers: sends prompts (evidence: `README.md`)
- Article routes → Subtitle import: imports subtitles (evidence: `app/routers/articles.py`)
- Article routes → Article practice: serves practice (evidence: `app/routers/articles.py`)
- Article routes → Explanation service: requests explanations (evidence: `app/routers/articles.py`)
- Article routes → Speech synthesis: requests audio (evidence: `app/routers/articles.py`)
- Article routes → Vocabulary service: saves vocabulary (evidence: `app/routers/articles.py`)
- Translation routes → Vocabulary service: supports vocabulary
- Explanation service → Model client: generates explanations (evidence: `app/services/explain_service.py`)
- Speech services → LLM providers: transcribes speech (evidence: `README.md`)
- Web app → Speech services: submits speech (evidence: `README.md`)
- Web app → Speech synthesis: plays generated speech (evidence: `README.md`)
- SQLite database → Data models: creates tables (evidence: `app/database.py`)
- SQLite database → Runtime config: loads database URL (evidence: `app/database.py`)
- FastAPI app → SQLite database: initializes storage (evidence: `main.py`)
- Model client → Runtime config: reads model settings (evidence: `app/services/model_client.py`)
