# coach-montanha/montanha-language-ai architecture

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

- Interactive diagram: https://gitdiagram.com/coach-montanha/montanha-language-ai
- Repository: https://github.com/coach-montanha/montanha-language-ai

## Overview

Smart Language Studio is a browser-based language-learning app. The main workflow enters through the home route, authenticates or loads a learner session, and presents learning activities such as tutor conversation, scenarios, vocabulary practice and placement testing; progress and chat history are persisted locally and can sync through the server. The tree documents additional study, gamification, avatar, and language tools. Some feature components and routes were not sampled, so their internal connections are omitted unless the route or README shows them.

Main entry points: [`src/routes/index.tsx`](https://github.com/coach-montanha/montanha-language-ai/blob/main/src/routes/index.tsx) (Home app), [`src/components/tabs/ConversationTab.tsx`](https://github.com/coach-montanha/montanha-language-ai/blob/main/src/components/tabs/ConversationTab.tsx) (Tutor conversation), [`src/services/ai-engine.ts`](https://github.com/coach-montanha/montanha-language-ai/blob/main/src/services/ai-engine.ts) (Tutor AI engine), [`src/services/storage.ts`](https://github.com/coach-montanha/montanha-language-ai/blob/main/src/services/storage.ts) (Progress and chat storage)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["App and access"]
  node_home["Home app<br/>[index.tsx]"]
  node_login["Login screen<br/>[LoginScreen.tsx]"]
end

subgraph group_learning["Learning activities"]
  node_conversation["Tutor conversation"]
  node_voice["Voice call<br/>[VoiceCallModal.tsx]"]
  node_sprint["Daily sprint<br/>[DailySprintTab.tsx]"]
  node_scenarios["Scenario practice<br/>[ScenarioTab.tsx]"]
  node_flashcards["Flashcards<br/>[FlashcardsTab.tsx]"]
  node_alphabet["Alphabet study<br/>[AlphabetTab.tsx]"]
  node_breakdown["Language breakdown<br/>[BreakdownTab.tsx]"]
  node_placement["Placement test"]
  node_avatar["Avatar rendering<br/>[ModularAvatar.tsx]"]
  node_avatarcatalog["Avatar item catalog<br/>[avatar-items.ts]"]
  node_missions["Mission content<br/>[missions.ts]"]
  node_vocabulary["Vocabulary data<br/>[vocabulary.ts]"]
end

subgraph group_services["Learning services"]
  node_auth["Authentication<br/>[auth.ts]"]
  node_ai["Tutor AI engine<br/>[ai-engine.ts]"]
  node_gemini["Gemini provider<br/>[gemini.ts]"]
  node_speech["Speech services<br/>[speech.ts]"]
  node_gamification["Gamification<br/>[gamification.ts]"]
end

subgraph group_state["Learner state"]
  node_storage["Progress and chat storage<br/>[storage.ts]"]
  node_server["Sync API<br/>[api-handler.ts]"]
  node_userstore[("Server user store<br/>[user-store.ts]")]
end

node_learner(("Learner"))

node_learner -->|"opens"| node_home
node_home -->|"renders"| node_login
node_login -->|"authenticates"| node_auth
node_home -->|"renders"| node_conversation
node_home -->|"renders"| node_sprint
node_home -->|"renders"| node_scenarios
node_home -->|"renders"| node_flashcards
node_home -->|"renders"| node_alphabet
node_home -->|"renders"| node_breakdown
node_home -->|"renders"| node_placement
node_conversation -->|"requests replies"| node_ai
node_voice -->|"requests replies"| node_ai
node_conversation -->|"loads and saves chat"| node_storage
node_voice -->|"loads memory"| node_storage
node_ai -->|"calls provider"| node_gemini
node_home -->|"loads and saves progress"| node_storage
node_home -->|"loads session"| node_auth
node_home -->|"syncs learner data"| node_server
node_server -->|"reads and writes"| node_userstore
node_storage -->|"updates rewards"| node_gamification
node_conversation -->|"uses speech"| node_speech
node_voice -->|"uses speech"| node_speech
node_conversation -->|"renders companion"| node_avatar
node_avatar -->|"uses defaults"| node_avatarcatalog
node_ai -->|"uses vocabulary"| node_vocabulary

click node_home "https://github.com/coach-montanha/montanha-language-ai/blob/main/src/routes/index.tsx"
click node_login "https://github.com/coach-montanha/montanha-language-ai/blob/main/src/components/LoginScreen.tsx"
click node_auth "https://github.com/coach-montanha/montanha-language-ai/blob/main/src/services/auth.ts"
click node_conversation "https://github.com/coach-montanha/montanha-language-ai/blob/main/src/components/tabs/ConversationTab.tsx"
click node_voice "https://github.com/coach-montanha/montanha-language-ai/blob/main/src/components/VoiceCallModal.tsx"
click node_sprint "https://github.com/coach-montanha/montanha-language-ai/blob/main/src/components/tabs/DailySprintTab.tsx"
click node_scenarios "https://github.com/coach-montanha/montanha-language-ai/blob/main/src/components/tabs/ScenarioTab.tsx"
click node_flashcards "https://github.com/coach-montanha/montanha-language-ai/blob/main/src/components/tabs/FlashcardsTab.tsx"
click node_alphabet "https://github.com/coach-montanha/montanha-language-ai/blob/main/src/components/tabs/AlphabetTab.tsx"
click node_breakdown "https://github.com/coach-montanha/montanha-language-ai/blob/main/src/components/tabs/BreakdownTab.tsx"
click node_placement "https://github.com/coach-montanha/montanha-language-ai/blob/main/src/components/PlacementTestModal.tsx"
click node_ai "https://github.com/coach-montanha/montanha-language-ai/blob/main/src/services/ai-engine.ts"
click node_gemini "https://github.com/coach-montanha/montanha-language-ai/blob/main/src/services/gemini.ts"
click node_speech "https://github.com/coach-montanha/montanha-language-ai/blob/main/src/services/speech.ts"
click node_gamification "https://github.com/coach-montanha/montanha-language-ai/blob/main/src/services/gamification.ts"
click node_storage "https://github.com/coach-montanha/montanha-language-ai/blob/main/src/services/storage.ts"
click node_server "https://github.com/coach-montanha/montanha-language-ai/blob/main/src/server/api-handler.ts"
click node_userstore "https://github.com/coach-montanha/montanha-language-ai/blob/main/src/server/user-store.ts"
click node_avatar "https://github.com/coach-montanha/montanha-language-ai/blob/main/src/components/avatar/ModularAvatar.tsx"
click node_avatarcatalog "https://github.com/coach-montanha/montanha-language-ai/blob/main/src/data/avatar-items.ts"
click node_missions "https://github.com/coach-montanha/montanha-language-ai/blob/main/src/data/missions.ts"
click node_vocabulary "https://github.com/coach-montanha/montanha-language-ai/blob/main/src/data/vocabulary.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_home,node_login toneBlue
class node_conversation,node_voice,node_sprint,node_scenarios,node_flashcards,node_alphabet,node_breakdown,node_placement,node_avatar,node_avatarcatalog,node_missions,node_vocabulary toneAmber
class node_auth,node_ai,node_gemini,node_speech,node_gamification toneMint
class node_storage,node_server,node_userstore toneRose
class node_learner toneIndigo
```

## Components

### App and access

- [Home app](https://github.com/coach-montanha/montanha-language-ai/blob/main/src/routes/index.tsx): `src/routes/index.tsx`
- [Login screen](https://github.com/coach-montanha/montanha-language-ai/blob/main/src/components/LoginScreen.tsx): `src/components/LoginScreen.tsx`

### Learning activities

- [Tutor conversation](https://github.com/coach-montanha/montanha-language-ai/blob/main/src/components/tabs/ConversationTab.tsx): `src/components/tabs/ConversationTab.tsx`
- [Voice call](https://github.com/coach-montanha/montanha-language-ai/blob/main/src/components/VoiceCallModal.tsx): `src/components/VoiceCallModal.tsx`
- [Daily sprint](https://github.com/coach-montanha/montanha-language-ai/blob/main/src/components/tabs/DailySprintTab.tsx): `src/components/tabs/DailySprintTab.tsx`
- [Scenario practice](https://github.com/coach-montanha/montanha-language-ai/blob/main/src/components/tabs/ScenarioTab.tsx): `src/components/tabs/ScenarioTab.tsx`
- [Flashcards](https://github.com/coach-montanha/montanha-language-ai/blob/main/src/components/tabs/FlashcardsTab.tsx): `src/components/tabs/FlashcardsTab.tsx`
- [Alphabet study](https://github.com/coach-montanha/montanha-language-ai/blob/main/src/components/tabs/AlphabetTab.tsx): `src/components/tabs/AlphabetTab.tsx`
- [Language breakdown](https://github.com/coach-montanha/montanha-language-ai/blob/main/src/components/tabs/BreakdownTab.tsx): `src/components/tabs/BreakdownTab.tsx`
- [Placement test](https://github.com/coach-montanha/montanha-language-ai/blob/main/src/components/PlacementTestModal.tsx): `src/components/PlacementTestModal.tsx`
- [Avatar rendering](https://github.com/coach-montanha/montanha-language-ai/blob/main/src/components/avatar/ModularAvatar.tsx): `src/components/avatar/ModularAvatar.tsx`
- [Avatar item catalog](https://github.com/coach-montanha/montanha-language-ai/blob/main/src/data/avatar-items.ts): `src/data/avatar-items.ts`
- [Mission content](https://github.com/coach-montanha/montanha-language-ai/blob/main/src/data/missions.ts): `src/data/missions.ts`
- [Vocabulary data](https://github.com/coach-montanha/montanha-language-ai/blob/main/src/data/vocabulary.ts): `src/data/vocabulary.ts`

### Learning services

- [Authentication](https://github.com/coach-montanha/montanha-language-ai/blob/main/src/services/auth.ts): `src/services/auth.ts`
- [Tutor AI engine](https://github.com/coach-montanha/montanha-language-ai/blob/main/src/services/ai-engine.ts): `src/services/ai-engine.ts`
- [Gemini provider](https://github.com/coach-montanha/montanha-language-ai/blob/main/src/services/gemini.ts): `src/services/gemini.ts`
- [Speech services](https://github.com/coach-montanha/montanha-language-ai/blob/main/src/services/speech.ts): `src/services/speech.ts`
- [Gamification](https://github.com/coach-montanha/montanha-language-ai/blob/main/src/services/gamification.ts): `src/services/gamification.ts`

### Learner state

- [Progress and chat storage](https://github.com/coach-montanha/montanha-language-ai/blob/main/src/services/storage.ts): `src/services/storage.ts`
- [Sync API](https://github.com/coach-montanha/montanha-language-ai/blob/main/src/server/api-handler.ts): `src/server/api-handler.ts`
- [Server user store](https://github.com/coach-montanha/montanha-language-ai/blob/main/src/server/user-store.ts): `src/server/user-store.ts`

### Other components

- **Learner**

## Connections

- Learner → Home app: opens (evidence: `src/routes/index.tsx`)
- Home app → Login screen: renders (evidence: `src/routes/index.tsx`)
- Login screen → Authentication: authenticates (evidence: `src/components/LoginScreen.tsx`)
- Home app → Tutor conversation: renders (evidence: `src/routes/index.tsx`)
- Home app → Daily sprint: renders (evidence: `src/routes/index.tsx`)
- Home app → Scenario practice: renders (evidence: `src/routes/index.tsx`)
- Home app → Flashcards: renders (evidence: `src/routes/index.tsx`)
- Home app → Alphabet study: renders (evidence: `src/routes/index.tsx`)
- Home app → Language breakdown: renders (evidence: `src/routes/index.tsx`)
- Home app → Placement test: renders (evidence: `src/routes/index.tsx`)
- Tutor conversation → Tutor AI engine: requests replies (evidence: `src/components/tabs/ConversationTab.tsx`)
- Voice call → Tutor AI engine: requests replies (evidence: `src/components/VoiceCallModal.tsx`)
- Tutor conversation → Progress and chat storage: loads and saves chat (evidence: `src/components/tabs/ConversationTab.tsx`)
- Voice call → Progress and chat storage: loads memory (evidence: `src/components/VoiceCallModal.tsx`)
- Tutor AI engine → Gemini provider: calls provider (evidence: `src/services/ai-engine.ts`)
- Home app → Progress and chat storage: loads and saves progress (evidence: `src/routes/index.tsx`)
- Home app → Authentication: loads session (evidence: `src/routes/index.tsx`)
- Home app → Sync API: syncs learner data (evidence: `src/routes/index.tsx`)
- Sync API → Server user store: reads and writes (evidence: `src/server/api-handler.ts`)
- Progress and chat storage → Gamification: updates rewards (evidence: `src/services/storage.ts`)
- Tutor conversation → Speech services: uses speech (evidence: `src/components/tabs/ConversationTab.tsx`)
- Voice call → Speech services: uses speech (evidence: `src/components/VoiceCallModal.tsx`)
- Tutor conversation → Avatar rendering: renders companion (evidence: `src/components/tabs/ConversationTab.tsx`)
- Avatar rendering → Avatar item catalog: uses defaults (evidence: `src/components/avatar/ModularAvatar.tsx`)
- Tutor AI engine → Vocabulary data: uses vocabulary (evidence: `src/services/ai-engine.ts`)
