# xialeistudio/echoic architecture

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

- Interactive diagram: https://gitdiagram.com/xialeistudio/echoic
- Repository: https://github.com/xialeistudio/echoic

## Overview

Echoic is an AI speaking-practice application. Learners import audio or choose a curated episode, practice sentence by sentence, and review pronunciation scores and history; a separate oral-practice flow generates prompts and evaluates responses. The graph preserves the documented collection, gallery, analytics, and optional sentence-analysis capabilities. Source excerpts establish selected backend routing and service-factory relationships; unsampled feature routes and frontend API wiring are represented cautiously using README evidence.

Main entry points: [`backend/app/api/routes/audio.py`](https://github.com/xialeistudio/echoic/blob/main/backend/app/api/routes/audio.py) (Audio workflows), [`backend/app/services/factory.py`](https://github.com/xialeistudio/echoic/blob/main/backend/app/services/factory.py) (Service selection), [`backend/app/main.py`](https://github.com/xialeistudio/echoic/blob/main/backend/app/main.py) (FastAPI application), [`backend/app/api/routes/oral.py`](https://github.com/xialeistudio/echoic/blob/main/backend/app/api/routes/oral.py) (Oral workflows)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Learner interface"]
  node_app["Page router<br/>[App.jsx]"]
  node_audio_library["Audio library<br/>[AudioLibrary.jsx]"]
  node_gallery_ui["Content gallery<br/>[Gallery.jsx]"]
  node_sentence_practice["Sentence practice<br/>[Practice.jsx]"]
  node_oral_practice_ui["Oral practice<br/>[OralPractice.jsx]"]
  node_oral_hook["Oral session hook<br/>[useOralPractice.js]"]
  node_overview["Progress overview<br/>[Overview.jsx]"]
end

subgraph group_api["Application workflows"]
  node_audio_routes["Audio workflows<br/>[audio.py]"]
  node_oral_routes["Oral workflows<br/>[oral.py]"]
  node_practice_routes["Practice history<br/>[practice.py]"]
  node_gallery_routes["Gallery imports<br/>[gallery.py]"]
  node_collections_routes["Collections<br/>[collections.py]"]
  node_stats_routes["Activity statistics<br/>[stats.py]"]
  node_api_server["FastAPI application<br/>[main.py]"]
end

subgraph group_speech["Speech processing"]
  node_asr["Transcription<br/>[whisperx.py]"]
  node_alignment["Word alignment<br/>[wav2vec2.py]"]
  node_scoring["Phoneme scoring<br/>[phoneme.py]"]
  node_service_factory["Service selection<br/>[factory.py]"]
end

subgraph group_ai_content["AI and content"]
  node_gallery_sources["VOA and BBC sources"]
  node_llm["LLM services"]
end

subgraph group_state["Persistence and media"]
  node_database[("Application database<br/>[db.py]")]
  node_storage["Audio storage<br/>[local.py]"]
  node_models["Audio and attempt records"]
end

node_learner(("Learner"))

node_learner -->|"uses"| node_app
node_app -->|"routes to"| node_audio_library
node_app -->|"routes to"| node_gallery_ui
node_app -->|"routes to"| node_sentence_practice
node_app -->|"routes to"| node_oral_practice_ui
node_learner -->|"reviews progress"| node_overview
node_audio_library -->|"imports audio"| node_audio_routes
node_gallery_ui -->|"imports episodes"| node_gallery_routes
node_sentence_practice -->|"records attempts"| node_practice_routes
node_oral_practice_ui -->|"uses session flow"| node_oral_hook
node_oral_practice_ui -->|"submits responses"| node_oral_routes
node_api_server -->|"mounts routes"| node_audio_routes
node_api_server -->|"mounts routes"| node_oral_routes
node_api_server -->|"mounts routes"| node_practice_routes
node_api_server -->|"mounts routes"| node_gallery_routes
node_api_server -->|"mounts routes"| node_collections_routes
node_api_server -->|"mounts routes"| node_stats_routes
node_audio_routes -->|"transcribes audio"| node_asr
node_audio_routes -->|"resolves services"| node_service_factory
node_oral_routes -->|"resolves services"| node_service_factory
node_service_factory -->|"creates backend"| node_asr
node_service_factory -->|"creates backend"| node_alignment
node_service_factory -->|"creates backend"| node_scoring
node_service_factory -->|"selects provider"| node_llm
node_service_factory -->|"selects backend"| node_storage
node_audio_routes -.->|"aligns speech"| node_alignment
node_audio_routes -.->|"scores pronunciation"| node_scoring
node_oral_routes -->|"generates and evaluates"| node_llm
node_audio_routes -->|"analyzes sentences"| node_llm
node_gallery_routes -.->|"imports episodes"| node_gallery_sources
node_audio_routes -->|"reads and writes"| node_database
node_oral_routes -->|"saves attempts"| node_database
node_audio_routes -->|"stores audio"| node_storage
node_audio_routes -->|"persists audio records"| node_models
node_oral_routes -->|"persists oral attempts"| node_models
node_practice_routes -.->|"uses practice records"| node_models
node_gallery_routes -.->|"saves imported items"| node_database

click node_app "https://github.com/xialeistudio/echoic/blob/main/frontend/src/App.jsx"
click node_audio_library "https://github.com/xialeistudio/echoic/blob/main/frontend/src/pages/AudioLibrary.jsx"
click node_gallery_ui "https://github.com/xialeistudio/echoic/blob/main/frontend/src/pages/Gallery.jsx"
click node_sentence_practice "https://github.com/xialeistudio/echoic/blob/main/frontend/src/pages/Practice.jsx"
click node_oral_practice_ui "https://github.com/xialeistudio/echoic/blob/main/frontend/src/pages/OralPractice.jsx"
click node_oral_hook "https://github.com/xialeistudio/echoic/blob/main/frontend/src/hooks/useOralPractice.js"
click node_overview "https://github.com/xialeistudio/echoic/blob/main/frontend/src/pages/Overview.jsx"
click node_audio_routes "https://github.com/xialeistudio/echoic/blob/main/backend/app/api/routes/audio.py"
click node_oral_routes "https://github.com/xialeistudio/echoic/blob/main/backend/app/api/routes/oral.py"
click node_practice_routes "https://github.com/xialeistudio/echoic/blob/main/backend/app/api/routes/practice.py"
click node_gallery_routes "https://github.com/xialeistudio/echoic/blob/main/backend/app/api/routes/gallery.py"
click node_collections_routes "https://github.com/xialeistudio/echoic/blob/main/backend/app/api/routes/collections.py"
click node_stats_routes "https://github.com/xialeistudio/echoic/blob/main/backend/app/api/routes/stats.py"
click node_asr "https://github.com/xialeistudio/echoic/blob/main/backend/app/services/asr/whisperx.py"
click node_alignment "https://github.com/xialeistudio/echoic/blob/main/backend/app/services/alignment/wav2vec2.py"
click node_scoring "https://github.com/xialeistudio/echoic/blob/main/backend/app/services/scoring/phoneme.py"
click node_service_factory "https://github.com/xialeistudio/echoic/blob/main/backend/app/services/factory.py"
click node_gallery_sources "https://github.com/xialeistudio/echoic/tree/main/backend/app/services/gallery"
click node_llm "https://github.com/xialeistudio/echoic/tree/main/backend/app/services/llm"
click node_database "https://github.com/xialeistudio/echoic/blob/main/backend/app/db.py"
click node_storage "https://github.com/xialeistudio/echoic/blob/main/backend/app/services/storage/local.py"
click node_models "https://github.com/xialeistudio/echoic/tree/main/backend/app/models"
click node_api_server "https://github.com/xialeistudio/echoic/blob/main/backend/app/main.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_app,node_audio_library,node_gallery_ui,node_sentence_practice,node_oral_practice_ui,node_oral_hook,node_overview toneBlue
class node_audio_routes,node_oral_routes,node_practice_routes,node_gallery_routes,node_collections_routes,node_stats_routes,node_api_server toneAmber
class node_asr,node_alignment,node_scoring,node_service_factory toneMint
class node_gallery_sources,node_llm toneRose
class node_database,node_storage,node_models,node_learner toneIndigo
```

## Components

### Learner interface

- [Page router](https://github.com/xialeistudio/echoic/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Audio library](https://github.com/xialeistudio/echoic/blob/main/frontend/src/pages/AudioLibrary.jsx): `frontend/src/pages/AudioLibrary.jsx`
- [Content gallery](https://github.com/xialeistudio/echoic/blob/main/frontend/src/pages/Gallery.jsx): `frontend/src/pages/Gallery.jsx`
- [Sentence practice](https://github.com/xialeistudio/echoic/blob/main/frontend/src/pages/Practice.jsx): `frontend/src/pages/Practice.jsx`
- [Oral practice](https://github.com/xialeistudio/echoic/blob/main/frontend/src/pages/OralPractice.jsx): `frontend/src/pages/OralPractice.jsx`
- [Oral session hook](https://github.com/xialeistudio/echoic/blob/main/frontend/src/hooks/useOralPractice.js): `frontend/src/hooks/useOralPractice.js`
- [Progress overview](https://github.com/xialeistudio/echoic/blob/main/frontend/src/pages/Overview.jsx): `frontend/src/pages/Overview.jsx`

### Application workflows

- [Audio workflows](https://github.com/xialeistudio/echoic/blob/main/backend/app/api/routes/audio.py): `backend/app/api/routes/audio.py`
- [Oral workflows](https://github.com/xialeistudio/echoic/blob/main/backend/app/api/routes/oral.py): `backend/app/api/routes/oral.py`
- [Practice history](https://github.com/xialeistudio/echoic/blob/main/backend/app/api/routes/practice.py): `backend/app/api/routes/practice.py`
- [Gallery imports](https://github.com/xialeistudio/echoic/blob/main/backend/app/api/routes/gallery.py): `backend/app/api/routes/gallery.py`
- [Collections](https://github.com/xialeistudio/echoic/blob/main/backend/app/api/routes/collections.py): `backend/app/api/routes/collections.py`
- [Activity statistics](https://github.com/xialeistudio/echoic/blob/main/backend/app/api/routes/stats.py): `backend/app/api/routes/stats.py`
- [FastAPI application](https://github.com/xialeistudio/echoic/blob/main/backend/app/main.py): `backend/app/main.py`

### Speech processing

- [Transcription](https://github.com/xialeistudio/echoic/blob/main/backend/app/services/asr/whisperx.py): `backend/app/services/asr/whisperx.py`
- [Word alignment](https://github.com/xialeistudio/echoic/blob/main/backend/app/services/alignment/wav2vec2.py): `backend/app/services/alignment/wav2vec2.py`
- [Phoneme scoring](https://github.com/xialeistudio/echoic/blob/main/backend/app/services/scoring/phoneme.py): `backend/app/services/scoring/phoneme.py`
- [Service selection](https://github.com/xialeistudio/echoic/blob/main/backend/app/services/factory.py): `backend/app/services/factory.py`

### AI and content

- [VOA and BBC sources](https://github.com/xialeistudio/echoic/tree/main/backend/app/services/gallery): `backend/app/services/gallery`
- [LLM services](https://github.com/xialeistudio/echoic/tree/main/backend/app/services/llm): `backend/app/services/llm`

### Persistence and media

- [Application database](https://github.com/xialeistudio/echoic/blob/main/backend/app/db.py): `backend/app/db.py`
- [Audio storage](https://github.com/xialeistudio/echoic/blob/main/backend/app/services/storage/local.py): `backend/app/services/storage/local.py`
- [Audio and attempt records](https://github.com/xialeistudio/echoic/tree/main/backend/app/models): `backend/app/models`

### Other components

- **Learner**

## Connections

- Learner → Page router: uses (evidence: `README.md`)
- Page router → Audio library: routes to (evidence: `frontend/src/App.jsx`)
- Page router → Content gallery: routes to (evidence: `frontend/src/App.jsx`)
- Page router → Sentence practice: routes to (evidence: `frontend/src/App.jsx`)
- Page router → Oral practice: routes to (evidence: `frontend/src/App.jsx`)
- Learner → Progress overview: reviews progress (evidence: `README.md`)
- Audio library → Audio workflows: imports audio (evidence: `README.md`)
- Content gallery → Gallery imports: imports episodes (evidence: `README.md`)
- Sentence practice → Practice history: records attempts (evidence: `README.md`)
- Oral practice → Oral session hook: uses session flow
- Oral practice → Oral workflows: submits responses (evidence: `README.md`)
- FastAPI application → Audio workflows: mounts routes (evidence: `backend/app/main.py`)
- FastAPI application → Oral workflows: mounts routes (evidence: `backend/app/main.py`)
- FastAPI application → Practice history: mounts routes (evidence: `backend/app/main.py`)
- FastAPI application → Gallery imports: mounts routes (evidence: `backend/app/main.py`)
- FastAPI application → Collections: mounts routes (evidence: `backend/app/main.py`)
- FastAPI application → Activity statistics: mounts routes (evidence: `backend/app/main.py`)
- Audio workflows → Transcription: transcribes audio (evidence: `backend/app/api/routes/audio.py`)
- Audio workflows → Service selection: resolves services (evidence: `backend/app/api/routes/audio.py`)
- Oral workflows → Service selection: resolves services (evidence: `backend/app/api/routes/oral.py`)
- Service selection → Transcription: creates backend (evidence: `backend/app/services/factory.py`)
- Service selection → Word alignment: creates backend (evidence: `backend/app/services/factory.py`)
- Service selection → Phoneme scoring: creates backend (evidence: `backend/app/services/factory.py`)
- Service selection → LLM services: selects provider (evidence: `backend/app/services/factory.py`)
- Service selection → Audio storage: selects backend (evidence: `backend/app/services/factory.py`)
- Audio workflows → Word alignment: aligns speech
- Audio workflows → Phoneme scoring: scores pronunciation
- Oral workflows → LLM services: generates and evaluates (evidence: `backend/app/api/routes/oral.py`)
- Audio workflows → LLM services: analyzes sentences (evidence: `backend/app/api/routes/audio.py`)
- Gallery imports → VOA and BBC sources: imports episodes
- Audio workflows → Application database: reads and writes (evidence: `backend/app/api/routes/audio.py`)
- Oral workflows → Application database: saves attempts (evidence: `backend/app/api/routes/oral.py`)
- Audio workflows → Audio storage: stores audio (evidence: `backend/app/api/routes/audio.py`)
- Audio workflows → Audio and attempt records: persists audio records (evidence: `backend/app/api/routes/audio.py`)
- Oral workflows → Audio and attempt records: persists oral attempts (evidence: `backend/app/api/routes/oral.py`)
- Practice history → Audio and attempt records: uses practice records
- Gallery imports → Application database: saves imported items
