# datascientist88/german_lang_trainer_v1 architecture

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

- Interactive diagram: https://gitdiagram.com/datascientist88/german_lang_trainer_v1
- Repository: https://github.com/datascientist88/german_lang_trainer_v1

## Overview

This is a patient-facing hospital assistant web app, with voice and text interaction modes and an optional avatar page. The intended workflow is a visitor asking for hospital navigation help and receiving a spoken or streamed-text response. The sampled backend also implements a Realtime session endpoint and vector search, but its prompt describes a German-language tutor rather than the hospital assistant; the README documents text-chat endpoints that are not present in the sampled backend. The graph shows those documented text services as external and limits backend connections to visible code.

Main entry points: [`frontend/src/components/VoiceAssistant.jsx`](https://github.com/datascientist88/german_lang_trainer_v1/blob/master/frontend/src/components/VoiceAssistant.jsx) (Voice assistant), [`frontend/src/App.js`](https://github.com/datascientist88/german_lang_trainer_v1/blob/master/frontend/src/App.js) (App routing), [`frontend/src/components/Chat.jsx`](https://github.com/datascientist88/german_lang_trainer_v1/blob/master/frontend/src/components/Chat.jsx) (Text chat), [`backend/app.py`](https://github.com/datascientist88/german_lang_trainer_v1/blob/master/backend/app.py) (Realtime signaling)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Web application"]
  node_app["App routing<br/>[App.js]"]
  node_navbar["Navigation and theme<br/>[Navbar.jsx]"]
  node_voicepage["Voice page"]
  node_textpage["Chat page<br/>[TextChatPage.jsx]"]
  node_avatar["Avatar page<br/>[AvatarPage.jsx]"]
  node_theme["Theme switch<br/>[ThemeSwitch.jsx]"]
end

subgraph group_voice["Voice interaction"]
  node_voice["Voice assistant<br/>[VoiceAssistant.jsx]"]
  node_orb["Audio orb<br/>[BaseOrb.jsx]"]
  node_wave["Audio wave<br/>[AudioWave.jsx]"]
  node_level["Audio level analysis"]
  node_wav["PCM to WAV<br/>[pcmToWav.js]"]
  node_visualstate[("Visualizer state")]
end

subgraph group_chat["Text interaction"]
  node_chat["Text chat<br/>[Chat.jsx]"]
  node_input["Chat input"]
  node_mermaid["Diagram rendering<br/>[Mermaid.jsx]"]
end

subgraph group_services["Assistant services"]
  node_chatservice["Hosted chat service"]
  node_rtc["Realtime signaling<br/>[app.py]"]
  node_prompt["Realtime instructions<br/>[system_prompt.py]"]
  node_search["Vector search endpoint<br/>[app.py]"]
end

node_visitor(("Visitor"))
node_openai["OpenAI Realtime"]
node_qdrant[("Qdrant vector store")]

node_visitor -->|"opens"| node_app
node_app -->|"routes to"| node_voicepage
node_app -->|"routes to"| node_textpage
node_app -->|"routes to"| node_avatar
node_app -->|"renders"| node_navbar
node_navbar -->|"renders"| node_theme
node_voicepage -->|"renders"| node_voice
node_textpage -->|"loads"| node_chat
node_voice -->|"renders"| node_orb
node_voice -->|"monitors mic"| node_level
node_voice -->|"encodes audio"| node_wav
node_voice -->|"updates"| node_visualstate
node_orb -->|"reads scale"| node_visualstate
node_orb -->|"enhances scale"| node_level
node_voice -.->|"renders visualizer"| node_wave
node_voice -.->|"exchanges SDP"| node_rtc
node_rtc -->|"sets instructions"| node_prompt
node_rtc -->|"creates session"| node_openai
node_rtc -->|"exchanges SDP"| node_openai
node_chat -->|"renders"| node_input
node_chat -->|"renders diagrams"| node_mermaid
node_chat -->|"streams chat"| node_chatservice
node_chat -->|"fetches suggestions"| node_chatservice
node_visitor -.->|"submits query"| node_search
node_search -->|"searches vectors"| node_qdrant

click node_app "https://github.com/datascientist88/german_lang_trainer_v1/blob/master/frontend/src/App.js"
click node_navbar "https://github.com/datascientist88/german_lang_trainer_v1/blob/master/frontend/src/components/Navbar.jsx"
click node_voicepage "https://github.com/datascientist88/german_lang_trainer_v1/blob/master/frontend/src/pages/VoiceAssistantPage.jsx"
click node_textpage "https://github.com/datascientist88/german_lang_trainer_v1/blob/master/frontend/src/pages/TextChatPage.jsx"
click node_avatar "https://github.com/datascientist88/german_lang_trainer_v1/blob/master/frontend/src/pages/AvatarPage.jsx"
click node_voice "https://github.com/datascientist88/german_lang_trainer_v1/blob/master/frontend/src/components/VoiceAssistant.jsx"
click node_orb "https://github.com/datascientist88/german_lang_trainer_v1/blob/master/frontend/src/components/BaseOrb.jsx"
click node_wave "https://github.com/datascientist88/german_lang_trainer_v1/blob/master/frontend/src/components/AudioWave.jsx"
click node_level "https://github.com/datascientist88/german_lang_trainer_v1/blob/master/frontend/src/components/audioLevelAnalyzer.jsx"
click node_wav "https://github.com/datascientist88/german_lang_trainer_v1/blob/master/frontend/src/components/pcmToWav.js"
click node_visualstate "https://github.com/datascientist88/german_lang_trainer_v1/blob/master/frontend/src/store/useAudioForVisualizerStore.js"
click node_chat "https://github.com/datascientist88/german_lang_trainer_v1/blob/master/frontend/src/components/Chat.jsx"
click node_input "https://github.com/datascientist88/german_lang_trainer_v1/blob/master/frontend/src/components/ChatInputWidget.jsx"
click node_mermaid "https://github.com/datascientist88/german_lang_trainer_v1/blob/master/frontend/src/components/Mermaid.jsx"
click node_rtc "https://github.com/datascientist88/german_lang_trainer_v1/blob/master/backend/app.py"
click node_prompt "https://github.com/datascientist88/german_lang_trainer_v1/blob/master/backend/prompts/system_prompt.py"
click node_search "https://github.com/datascientist88/german_lang_trainer_v1/blob/master/backend/app.py"
click node_theme "https://github.com/datascientist88/german_lang_trainer_v1/blob/master/frontend/src/components/ThemeSwitch.jsx"

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_navbar,node_voicepage,node_textpage,node_avatar,node_theme toneBlue
class node_voice,node_orb,node_wave,node_level,node_wav,node_visualstate,node_qdrant toneAmber
class node_chat,node_input,node_mermaid toneMint
class node_chatservice,node_rtc,node_prompt,node_search toneRose
class node_visitor,node_openai toneIndigo
```

## Components

### Web application

- [App routing](https://github.com/datascientist88/german_lang_trainer_v1/blob/master/frontend/src/App.js): `frontend/src/App.js`
- [Navigation and theme](https://github.com/datascientist88/german_lang_trainer_v1/blob/master/frontend/src/components/Navbar.jsx): `frontend/src/components/Navbar.jsx`
- [Voice page](https://github.com/datascientist88/german_lang_trainer_v1/blob/master/frontend/src/pages/VoiceAssistantPage.jsx): `frontend/src/pages/VoiceAssistantPage.jsx`
- [Chat page](https://github.com/datascientist88/german_lang_trainer_v1/blob/master/frontend/src/pages/TextChatPage.jsx): `frontend/src/pages/TextChatPage.jsx`
- [Avatar page](https://github.com/datascientist88/german_lang_trainer_v1/blob/master/frontend/src/pages/AvatarPage.jsx): `frontend/src/pages/AvatarPage.jsx`
- [Theme switch](https://github.com/datascientist88/german_lang_trainer_v1/blob/master/frontend/src/components/ThemeSwitch.jsx): `frontend/src/components/ThemeSwitch.jsx`

### Voice interaction

- [Voice assistant](https://github.com/datascientist88/german_lang_trainer_v1/blob/master/frontend/src/components/VoiceAssistant.jsx): `frontend/src/components/VoiceAssistant.jsx`
- [Audio orb](https://github.com/datascientist88/german_lang_trainer_v1/blob/master/frontend/src/components/BaseOrb.jsx): `frontend/src/components/BaseOrb.jsx`
- [Audio wave](https://github.com/datascientist88/german_lang_trainer_v1/blob/master/frontend/src/components/AudioWave.jsx): `frontend/src/components/AudioWave.jsx`
- [Audio level analysis](https://github.com/datascientist88/german_lang_trainer_v1/blob/master/frontend/src/components/audioLevelAnalyzer.jsx): `frontend/src/components/audioLevelAnalyzer.jsx`
- [PCM to WAV](https://github.com/datascientist88/german_lang_trainer_v1/blob/master/frontend/src/components/pcmToWav.js): `frontend/src/components/pcmToWav.js`
- [Visualizer state](https://github.com/datascientist88/german_lang_trainer_v1/blob/master/frontend/src/store/useAudioForVisualizerStore.js): `frontend/src/store/useAudioForVisualizerStore.js`

### Text interaction

- [Text chat](https://github.com/datascientist88/german_lang_trainer_v1/blob/master/frontend/src/components/Chat.jsx): `frontend/src/components/Chat.jsx`
- [Chat input](https://github.com/datascientist88/german_lang_trainer_v1/blob/master/frontend/src/components/ChatInputWidget.jsx): `frontend/src/components/ChatInputWidget.jsx`
- [Diagram rendering](https://github.com/datascientist88/german_lang_trainer_v1/blob/master/frontend/src/components/Mermaid.jsx): `frontend/src/components/Mermaid.jsx`

### Assistant services

- **Hosted chat service**
- [Realtime signaling](https://github.com/datascientist88/german_lang_trainer_v1/blob/master/backend/app.py): `backend/app.py`
- [Realtime instructions](https://github.com/datascientist88/german_lang_trainer_v1/blob/master/backend/prompts/system_prompt.py): `backend/prompts/system_prompt.py`
- [Vector search endpoint](https://github.com/datascientist88/german_lang_trainer_v1/blob/master/backend/app.py): `backend/app.py`

### Other components

- **Visitor**
- **OpenAI Realtime**
- **Qdrant vector store**

## Connections

- Visitor → App routing: opens (evidence: `frontend/src/App.js`)
- App routing → Voice page: routes to (evidence: `frontend/src/App.js`)
- App routing → Chat page: routes to (evidence: `frontend/src/App.js`)
- App routing → Avatar page: routes to (evidence: `frontend/src/App.js`)
- App routing → Navigation and theme: renders (evidence: `frontend/src/App.js`)
- Navigation and theme → Theme switch: renders (evidence: `frontend/src/components/Navbar.jsx`)
- Voice page → Voice assistant: renders (evidence: `frontend/src/pages/VoiceAssistantPage.jsx`)
- Chat page → Text chat: loads (evidence: `frontend/src/pages/TextChatPage.jsx`)
- Voice assistant → Audio orb: renders (evidence: `frontend/src/components/VoiceAssistant.jsx`)
- Voice assistant → Audio level analysis: monitors mic (evidence: `frontend/src/components/VoiceAssistant.jsx`)
- Voice assistant → PCM to WAV: encodes audio (evidence: `frontend/src/components/VoiceAssistant.jsx`)
- Voice assistant → Visualizer state: updates (evidence: `frontend/src/components/VoiceAssistant.jsx`)
- Audio orb → Visualizer state: reads scale (evidence: `frontend/src/components/BaseOrb.jsx`)
- Audio orb → Audio level analysis: enhances scale (evidence: `frontend/src/components/BaseOrb.jsx`)
- Voice assistant → Audio wave: renders visualizer (evidence: `frontend/src/components/VoiceAssistant.jsx`)
- Voice assistant → Realtime signaling: exchanges SDP (evidence: `README.md`)
- Realtime signaling → Realtime instructions: sets instructions (evidence: `backend/app.py`)
- Realtime signaling → OpenAI Realtime: creates session (evidence: `backend/app.py`)
- Realtime signaling → OpenAI Realtime: exchanges SDP (evidence: `backend/app.py`)
- Text chat → Chat input: renders (evidence: `frontend/src/components/Chat.jsx`)
- Text chat → Diagram rendering: renders diagrams (evidence: `frontend/src/components/Chat.jsx`)
- Text chat → Hosted chat service: streams chat (evidence: `frontend/src/components/Chat.jsx`)
- Text chat → Hosted chat service: fetches suggestions (evidence: `frontend/src/components/Chat.jsx`)
- Visitor → Vector search endpoint: submits query
- Vector search endpoint → Qdrant vector store: searches vectors (evidence: `backend/app.py`)
