# kitrak005/boli-language-learning-app architecture

> Architecture diagram of the GitHub repository kitrak005/boli-language-learning-app, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-08-23). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/kitrak005/boli-language-learning-app
- Repository: https://github.com/kitrak005/boli-language-learning-app

## Overview

#### Purpose and Entry Points
A Vite/React TypeScript single-page learning application, apparently focused on language/cultural learning with lessons, practice, pronunciation coaching, progress tracking, and an “Ask Guru” assistant. Client bootstraps at `src/main.tsx`, renders the application shell in `src/App.tsx`, and is served through `index.html`. A separate TypeScript server/API surface is represented by `server.ts` and `api/ask-guru.ts`.

#### Application Shell and Navigation
`src/App.tsx` is the primary UI state coordinator: it likely selects active views, owns cross-view state, and opens shared modal/celebration experiences. Persistent app chrome is split into `src/components/TopAppBar.tsx` and `src/components/BottomNavBar.tsx`, establishing mobile-oriented navigation boundaries between home, learn, practice, explore, and profile flows.

#### Learning and Practice Experiences
The main content domains are isolated as view components:
- `src/components/HomeView.tsx`
- `src/components/LearnView.tsx`
- `src/components/PracticeView.tsx`

Lessons are launched or presented through `src/components/LessonModal.tsx`; tradition/course selection is handled by `src/components/TraditionSelectModal.tsx`. This separates navigation-level screens from focused instructional overlays.

#### Progress, Gamification, and Visualization
Learning progress is surfaced through dedicated components rather than embedded in each view:
- `src/components/DailyGoalTracker.tsx`
- `src/components/WeeklyXpD3Chart.tsx`
- `src/components/LevelUpCelebrationModal.tsx`

`src/components/ConfettiCanvas.tsx` supplies the visual celebration effect. The XP chart’s name indicates D3 is a material visualization runtime/dependency, while modal-driven level-up feedback is a distinct event boundary triggered by progress updates.

#### Speech and Audio Boundary
Pronunciation practice is encapsulated by `src/components/PronunciationCoach.tsx`, backed by browser-facing utility layers:
- `src/utils/speechRecognition.ts`
- `src/utils/audio.ts`

This boundary keeps Web Speech API recognition and audio playback/recording concerns outside lesson and practice UI orchestration. Browser microphone permission and speech-recognition availability are important runtime constraints.

#### Guru Assistant and Backend Boundary
`src/components/AskGuruChat.tsx` is the client chat interface. It communicates with a backend/API endpoint at `api/ask-guru.ts`, with `server.ts` likely providing local serving or API integration. Environment-backed secrets/configuration are implied by `.env.example`; AI-provider credentials should remain server-side and not enter the Vite client bundle.

#### Data Model and Supporting Runtime
`src/types.ts` defines shared domain contracts for lessons, learner state, navigation, or chat data. `src/data/mockData.ts` provides the current local content/state source, making the application likely demo- or prototype-oriented until persistence/content APIs replace it. Build and development execution use Vite via `vite.config.ts`, with dependencies and scripts defined in `package.json`.

Main entry points: [`src/App.tsx`](https://github.com/kitrak005/boli-language-learning-app/blob/master/src/App.tsx) (App shell), [`src/components/BottomNavBar.tsx`](https://github.com/kitrak005/boli-language-learning-app/blob/master/src/components/BottomNavBar.tsx) (Bottom navigation), [`src/components/PronunciationCoach.tsx`](https://github.com/kitrak005/boli-language-learning-app/blob/master/src/components/PronunciationCoach.tsx) (Pronunciation coach), [`src/data/mockData.ts`](https://github.com/kitrak005/boli-language-learning-app/blob/master/src/data/mockData.ts) (Local learning data)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Vite React Client"]
  node_vite{{"Vite runtime<br/>build runtime<br/>[vite.config.ts]"}}
  node_entry["Client entry<br/>React bootstrap<br/>[main.tsx]"]
  node_app["App shell<br/>UI coordinator<br/>[App.tsx]"]
  node_topbar["Top app bar<br/>shared chrome<br/>[TopAppBar.tsx]"]
  node_bottomnav["Bottom navigation<br/>shared chrome<br/>[BottomNavBar.tsx]"]
  node_types["Domain contracts<br/>TypeScript types<br/>[types.ts]"]
  node_guru["Ask Guru chat<br/>chat UI<br/>[AskGuruChat.tsx]"]
end

subgraph group_learning["Learning Experiences"]
  node_home["Home<br/>view<br/>[HomeView.tsx]"]
  node_learn["Learn<br/>view<br/>[LearnView.tsx]"]
  node_practice["Practice<br/>view<br/>[PracticeView.tsx]"]
  node_lesson["Lesson modal<br/>instruction overlay<br/>[LessonModal.tsx]"]
  node_tradition["Tradition selector<br/>course overlay"]
  node_mockdata[("Local learning data<br/>content source<br/>[mockData.ts]")]
end

subgraph group_progress["Progress &amp; Feedback"]
  node_goals["Daily goals<br/>progress UI"]
  node_xpchart["Weekly XP chart<br/>D3 visualization"]
  node_levelup["Level-up modal<br/>celebration overlay"]
  node_confetti["Confetti canvas<br/>celebration effect<br/>[ConfettiCanvas.tsx]"]
end

subgraph group_speech["Speech &amp; Audio"]
  node_coach["Pronunciation coach<br/>practice component"]
  node_recognition["Speech recognition<br/>browser API adapter"]
  node_audio["Audio utilities<br/>browser audio adapter<br/>[audio.ts]"]
end

subgraph group_backend["Guru Backend"]
  node_api["Ask Guru API<br/>server endpoint<br/>[ask-guru.ts]"]
  node_server{{"Server integration<br/>TypeScript server<br/>[server.ts]"}}
end

node_vite -->|"serves"| node_entry
node_entry -->|"renders"| node_app
node_app -->|"composes"| node_topbar
node_app -->|"composes"| node_bottomnav
node_bottomnav -->|"navigates"| node_home
node_bottomnav -->|"navigates"| node_learn
node_bottomnav -->|"navigates"| node_practice
node_app -->|"opens"| node_lesson
node_app -->|"opens"| node_tradition
node_learn -->|"loads content"| node_mockdata
node_lesson -->|"uses lessons"| node_mockdata
node_app -->|"shows progress"| node_goals
node_app -->|"shows progress"| node_xpchart
node_app -->|"triggers"| node_levelup
node_levelup -->|"renders"| node_confetti
node_practice -->|"hosts"| node_coach
node_coach -->|"recognizes speech"| node_recognition
node_coach -->|"records or plays"| node_audio
node_app -->|"opens"| node_guru
node_guru -->|"sends chat request"| node_api
node_server -->|"integrates"| node_api
node_app -.->|"uses contracts"| node_types
node_mockdata -.->|"conforms to"| node_types

click node_vite "https://github.com/kitrak005/boli-language-learning-app/blob/master/vite.config.ts"
click node_entry "https://github.com/kitrak005/boli-language-learning-app/blob/master/src/main.tsx"
click node_app "https://github.com/kitrak005/boli-language-learning-app/blob/master/src/App.tsx"
click node_topbar "https://github.com/kitrak005/boli-language-learning-app/blob/master/src/components/TopAppBar.tsx"
click node_bottomnav "https://github.com/kitrak005/boli-language-learning-app/blob/master/src/components/BottomNavBar.tsx"
click node_home "https://github.com/kitrak005/boli-language-learning-app/blob/master/src/components/HomeView.tsx"
click node_learn "https://github.com/kitrak005/boli-language-learning-app/blob/master/src/components/LearnView.tsx"
click node_practice "https://github.com/kitrak005/boli-language-learning-app/blob/master/src/components/PracticeView.tsx"
click node_lesson "https://github.com/kitrak005/boli-language-learning-app/blob/master/src/components/LessonModal.tsx"
click node_tradition "https://github.com/kitrak005/boli-language-learning-app/blob/master/src/components/TraditionSelectModal.tsx"
click node_mockdata "https://github.com/kitrak005/boli-language-learning-app/blob/master/src/data/mockData.ts"
click node_types "https://github.com/kitrak005/boli-language-learning-app/blob/master/src/types.ts"
click node_goals "https://github.com/kitrak005/boli-language-learning-app/blob/master/src/components/DailyGoalTracker.tsx"
click node_xpchart "https://github.com/kitrak005/boli-language-learning-app/blob/master/src/components/WeeklyXpD3Chart.tsx"
click node_levelup "https://github.com/kitrak005/boli-language-learning-app/blob/master/src/components/LevelUpCelebrationModal.tsx"
click node_confetti "https://github.com/kitrak005/boli-language-learning-app/blob/master/src/components/ConfettiCanvas.tsx"
click node_coach "https://github.com/kitrak005/boli-language-learning-app/blob/master/src/components/PronunciationCoach.tsx"
click node_recognition "https://github.com/kitrak005/boli-language-learning-app/blob/master/src/utils/speechRecognition.ts"
click node_audio "https://github.com/kitrak005/boli-language-learning-app/blob/master/src/utils/audio.ts"
click node_guru "https://github.com/kitrak005/boli-language-learning-app/blob/master/src/components/AskGuruChat.tsx"
click node_api "https://github.com/kitrak005/boli-language-learning-app/blob/master/api/ask-guru.ts"
click node_server "https://github.com/kitrak005/boli-language-learning-app/blob/master/server.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_vite,node_entry,node_app,node_topbar,node_bottomnav,node_types,node_guru toneBlue
class node_home,node_learn,node_practice,node_lesson,node_tradition,node_mockdata toneAmber
class node_goals,node_xpchart,node_levelup,node_confetti toneMint
class node_coach,node_recognition,node_audio toneRose
class node_api,node_server toneIndigo
```

## Components

### Vite React Client

Single-page learning experience.

- [Vite runtime](https://github.com/kitrak005/boli-language-learning-app/blob/master/vite.config.ts): build runtime · Builds and serves the client. · `vite.config.ts`
- [Client entry](https://github.com/kitrak005/boli-language-learning-app/blob/master/src/main.tsx): React bootstrap · `src/main.tsx`
- [App shell](https://github.com/kitrak005/boli-language-learning-app/blob/master/src/App.tsx): UI coordinator · Owns active-view and shared overlay state. · `src/App.tsx`
- [Top app bar](https://github.com/kitrak005/boli-language-learning-app/blob/master/src/components/TopAppBar.tsx): shared chrome · `src/components/TopAppBar.tsx`
- [Bottom navigation](https://github.com/kitrak005/boli-language-learning-app/blob/master/src/components/BottomNavBar.tsx): shared chrome · `src/components/BottomNavBar.tsx`
- [Domain contracts](https://github.com/kitrak005/boli-language-learning-app/blob/master/src/types.ts): TypeScript types · `src/types.ts`
- [Ask Guru chat](https://github.com/kitrak005/boli-language-learning-app/blob/master/src/components/AskGuruChat.tsx): chat UI · `src/components/AskGuruChat.tsx`

### Learning Experiences

- [Home](https://github.com/kitrak005/boli-language-learning-app/blob/master/src/components/HomeView.tsx): view · `src/components/HomeView.tsx`
- [Learn](https://github.com/kitrak005/boli-language-learning-app/blob/master/src/components/LearnView.tsx): view · `src/components/LearnView.tsx`
- [Practice](https://github.com/kitrak005/boli-language-learning-app/blob/master/src/components/PracticeView.tsx): view · `src/components/PracticeView.tsx`
- [Lesson modal](https://github.com/kitrak005/boli-language-learning-app/blob/master/src/components/LessonModal.tsx): instruction overlay · `src/components/LessonModal.tsx`
- [Tradition selector](https://github.com/kitrak005/boli-language-learning-app/blob/master/src/components/TraditionSelectModal.tsx): course overlay · `src/components/TraditionSelectModal.tsx`
- [Local learning data](https://github.com/kitrak005/boli-language-learning-app/blob/master/src/data/mockData.ts): content source · Current prototype content and state source. · `src/data/mockData.ts`

### Progress & Feedback

- [Daily goals](https://github.com/kitrak005/boli-language-learning-app/blob/master/src/components/DailyGoalTracker.tsx): progress UI · `src/components/DailyGoalTracker.tsx`
- [Weekly XP chart](https://github.com/kitrak005/boli-language-learning-app/blob/master/src/components/WeeklyXpD3Chart.tsx): D3 visualization · `src/components/WeeklyXpD3Chart.tsx`
- [Level-up modal](https://github.com/kitrak005/boli-language-learning-app/blob/master/src/components/LevelUpCelebrationModal.tsx): celebration overlay · `src/components/LevelUpCelebrationModal.tsx`
- [Confetti canvas](https://github.com/kitrak005/boli-language-learning-app/blob/master/src/components/ConfettiCanvas.tsx): celebration effect · `src/components/ConfettiCanvas.tsx`

### Speech & Audio

Browser capability boundary.

- [Pronunciation coach](https://github.com/kitrak005/boli-language-learning-app/blob/master/src/components/PronunciationCoach.tsx): practice component · Requires microphone permission and recognition support. · `src/components/PronunciationCoach.tsx`
- [Speech recognition](https://github.com/kitrak005/boli-language-learning-app/blob/master/src/utils/speechRecognition.ts): browser API adapter · `src/utils/speechRecognition.ts`
- [Audio utilities](https://github.com/kitrak005/boli-language-learning-app/blob/master/src/utils/audio.ts): browser audio adapter · `src/utils/audio.ts`

### Guru Backend

Server-side AI credential boundary.

- [Ask Guru API](https://github.com/kitrak005/boli-language-learning-app/blob/master/api/ask-guru.ts): server endpoint · Keeps AI-provider credentials off the client. · `api/ask-guru.ts`
- [Server integration](https://github.com/kitrak005/boli-language-learning-app/blob/master/server.ts): TypeScript server · Local serving or API integration surface. · `server.ts`

## Connections

- Vite runtime → Client entry: serves
- Client entry → App shell: renders
- App shell → Top app bar: composes
- App shell → Bottom navigation: composes
- Bottom navigation → Home: navigates
- Bottom navigation → Learn: navigates
- Bottom navigation → Practice: navigates
- App shell → Lesson modal: opens
- App shell → Tradition selector: opens
- Learn → Local learning data: loads content
- Lesson modal → Local learning data: uses lessons
- App shell → Daily goals: shows progress
- App shell → Weekly XP chart: shows progress
- App shell → Level-up modal: triggers
- Level-up modal → Confetti canvas: renders
- Practice → Pronunciation coach: hosts
- Pronunciation coach → Speech recognition: recognizes speech
- Pronunciation coach → Audio utilities: records or plays
- App shell → Ask Guru chat: opens
- Ask Guru chat → Ask Guru API: sends chat request
- Server integration → Ask Guru API: integrates
- App shell → Domain contracts: uses contracts
- Local learning data → Domain contracts: conforms to
