# khan-mehran/baby-learning architecture

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

- Interactive diagram: https://gitdiagram.com/khan-mehran/baby-learning
- Repository: https://github.com/khan-mehran/baby-learning

## Overview

Baby Learn is a browser-based early-learning app for English, math, Urdu, and general knowledge. A learner opens the subject picker, selects a subject or knowledge category, then explores items in a grid or one-by-one flashcards; the learning page can speak content and play recordings. The app also exposes persistent sound controls and an install prompt. The graph follows the routes and imports shown in the excerpts and source index; some PWA and dataset details are not sampled, so those relationships are omitted or marked unverified.

Main entry points: [`src/pages/LearningPage.tsx`](https://github.com/khan-mehran/baby-learning/blob/main/src/pages/LearningPage.tsx) (Topic lesson), [`src/pages/HomePage.tsx`](https://github.com/khan-mehran/baby-learning/blob/main/src/pages/HomePage.tsx) (Subject picker), [`src/data/index.ts`](https://github.com/khan-mehran/baby-learning/blob/main/src/data/index.ts) (Topic lookup), [`src/App.tsx`](https://github.com/khan-mehran/baby-learning/blob/main/src/App.tsx) (Route shell)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_navigation["App navigation"]
  node_app["Route shell<br/>[App.tsx]"]
  node_home["Subject picker<br/>[HomePage.tsx]"]
  node_gk_page["Knowledge categories"]
  node_entry["Browser entry<br/>[main.tsx]"]
end

subgraph group_learning["Learning experience"]
  node_learning_page["Topic lesson<br/>[LearningPage.tsx]"]
  node_flashcard["Flashcard display<br/>[FlashCard.tsx]"]
  node_grid_item["Grid item<br/>[LetterGridItem.tsx]"]
  node_nav_tabs["Lesson tabs<br/>[NavTabs.tsx]"]
  node_progress["Progress dots<br/>[ProgressDots.tsx]"]
  node_gk_categories["Category cards<br/>[CategoryCard.tsx]"]
  node_subject_cards["Subject cards<br/>[SubjectCard.tsx]"]
end

subgraph group_content["Learning content"]
  node_topics["Topic lookup<br/>[index.ts]"]
  node_english["English lessons<br/>[english.ts]"]
  node_math["Math lessons<br/>[math.ts]"]
  node_urdu["Urdu lessons<br/>[urdu.ts]"]
  node_gk_data["Knowledge lessons<br/>[gk.ts]"]
  node_colors["Color themes<br/>[colors.ts]"]
end

subgraph group_audio_pwa["Audio and install"]
  node_sound_toggle["Sound control<br/>[SoundToggle.tsx]"]
  node_store[("Mute preference<br/>[useAppStore.ts]")]
  node_audio_hook["Speech playback<br/>[useAudio.ts]"]
  node_install_card["Install prompt<br/>[InstallCard.tsx]"]
  node_pwa["PWA integration<br/>[pwa.ts]"]
  node_service_worker["Offline worker<br/>[sw.js]"]
end

node_learner(("Learner"))
node_speech_api["Browser speech"]
node_audio_api["Browser audio"]
node_browser_storage[("Local storage")]

node_learner -->|"opens"| node_app
node_app -->|"routes to"| node_home
node_app -->|"routes to"| node_gk_page
node_app -->|"routes to"| node_learning_page
node_home -->|"renders"| node_subject_cards
node_home -->|"renders"| node_install_card
node_home -.->|"navigates to"| node_gk_page
node_home -.->|"navigates to"| node_learning_page
node_gk_page -->|"renders"| node_gk_categories
node_gk_page -->|"reads categories"| node_topics
node_gk_page -.->|"navigates to"| node_learning_page
node_learning_page -->|"looks up topic"| node_topics
node_learning_page -->|"renders"| node_nav_tabs
node_learning_page -->|"renders"| node_grid_item
node_learning_page -->|"renders"| node_flashcard
node_learning_page -->|"renders"| node_progress
node_learning_page -->|"renders"| node_sound_toggle
node_topics -->|"includes"| node_english
node_topics -->|"includes"| node_math
node_topics -->|"includes"| node_urdu
node_topics -->|"includes"| node_gk_data
node_english -->|"uses colors"| node_colors
node_math -->|"uses colors"| node_colors
node_urdu -->|"uses colors"| node_colors
node_gk_data -->|"uses colors"| node_colors
node_home -->|"renders"| node_sound_toggle
node_sound_toggle -->|"reads mute state"| node_store
node_sound_toggle -->|"toggles mute"| node_store
node_store -->|"persists preference"| node_browser_storage
node_learning_page -->|"requests speech"| node_audio_hook
node_audio_hook -->|"reads mute state"| node_store
node_audio_hook -->|"speaks text"| node_speech_api
node_audio_hook -->|"plays recording"| node_audio_api
node_install_card -->|"uses install support"| node_pwa
node_entry -->|"mounts app"| node_app
node_entry -->|"initializes"| node_pwa
node_pwa -.->|"may register"| node_service_worker

click node_app "https://github.com/khan-mehran/baby-learning/blob/main/src/App.tsx"
click node_home "https://github.com/khan-mehran/baby-learning/blob/main/src/pages/HomePage.tsx"
click node_gk_page "https://github.com/khan-mehran/baby-learning/blob/main/src/pages/GeneralKnowledgePage.tsx"
click node_learning_page "https://github.com/khan-mehran/baby-learning/blob/main/src/pages/LearningPage.tsx"
click node_flashcard "https://github.com/khan-mehran/baby-learning/blob/main/src/components/FlashCard.tsx"
click node_grid_item "https://github.com/khan-mehran/baby-learning/blob/main/src/components/LetterGridItem.tsx"
click node_nav_tabs "https://github.com/khan-mehran/baby-learning/blob/main/src/components/NavTabs.tsx"
click node_progress "https://github.com/khan-mehran/baby-learning/blob/main/src/components/ProgressDots.tsx"
click node_gk_categories "https://github.com/khan-mehran/baby-learning/blob/main/src/components/CategoryCard.tsx"
click node_subject_cards "https://github.com/khan-mehran/baby-learning/blob/main/src/components/SubjectCard.tsx"
click node_topics "https://github.com/khan-mehran/baby-learning/blob/main/src/data/index.ts"
click node_english "https://github.com/khan-mehran/baby-learning/blob/main/src/data/english.ts"
click node_math "https://github.com/khan-mehran/baby-learning/blob/main/src/data/math.ts"
click node_urdu "https://github.com/khan-mehran/baby-learning/blob/main/src/data/urdu.ts"
click node_gk_data "https://github.com/khan-mehran/baby-learning/blob/main/src/data/gk.ts"
click node_colors "https://github.com/khan-mehran/baby-learning/blob/main/src/utils/colors.ts"
click node_sound_toggle "https://github.com/khan-mehran/baby-learning/blob/main/src/components/SoundToggle.tsx"
click node_store "https://github.com/khan-mehran/baby-learning/blob/main/src/store/useAppStore.ts"
click node_audio_hook "https://github.com/khan-mehran/baby-learning/blob/main/src/hooks/useAudio.ts"
click node_install_card "https://github.com/khan-mehran/baby-learning/blob/main/src/components/InstallCard.tsx"
click node_pwa "https://github.com/khan-mehran/baby-learning/blob/main/src/pwa.ts"
click node_entry "https://github.com/khan-mehran/baby-learning/blob/main/src/main.tsx"
click node_service_worker "https://github.com/khan-mehran/baby-learning/blob/main/public/sw.js"

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_home,node_gk_page,node_entry,node_speech_api,node_audio_api toneBlue
class node_learning_page,node_flashcard,node_grid_item,node_nav_tabs,node_progress,node_gk_categories,node_subject_cards,node_browser_storage toneAmber
class node_topics,node_english,node_math,node_urdu,node_gk_data,node_colors toneMint
class node_sound_toggle,node_store,node_audio_hook,node_install_card,node_pwa,node_service_worker toneRose
class node_learner toneIndigo
```

## Components

### App navigation

- [Route shell](https://github.com/khan-mehran/baby-learning/blob/main/src/App.tsx): `src/App.tsx`
- [Subject picker](https://github.com/khan-mehran/baby-learning/blob/main/src/pages/HomePage.tsx): `src/pages/HomePage.tsx`
- [Knowledge categories](https://github.com/khan-mehran/baby-learning/blob/main/src/pages/GeneralKnowledgePage.tsx): `src/pages/GeneralKnowledgePage.tsx`
- [Browser entry](https://github.com/khan-mehran/baby-learning/blob/main/src/main.tsx): `src/main.tsx`

### Learning experience

- [Topic lesson](https://github.com/khan-mehran/baby-learning/blob/main/src/pages/LearningPage.tsx): `src/pages/LearningPage.tsx`
- [Flashcard display](https://github.com/khan-mehran/baby-learning/blob/main/src/components/FlashCard.tsx): `src/components/FlashCard.tsx`
- [Grid item](https://github.com/khan-mehran/baby-learning/blob/main/src/components/LetterGridItem.tsx): `src/components/LetterGridItem.tsx`
- [Lesson tabs](https://github.com/khan-mehran/baby-learning/blob/main/src/components/NavTabs.tsx): `src/components/NavTabs.tsx`
- [Progress dots](https://github.com/khan-mehran/baby-learning/blob/main/src/components/ProgressDots.tsx): `src/components/ProgressDots.tsx`
- [Category cards](https://github.com/khan-mehran/baby-learning/blob/main/src/components/CategoryCard.tsx): `src/components/CategoryCard.tsx`
- [Subject cards](https://github.com/khan-mehran/baby-learning/blob/main/src/components/SubjectCard.tsx): `src/components/SubjectCard.tsx`

### Learning content

- [Topic lookup](https://github.com/khan-mehran/baby-learning/blob/main/src/data/index.ts): `src/data/index.ts`
- [English lessons](https://github.com/khan-mehran/baby-learning/blob/main/src/data/english.ts): `src/data/english.ts`
- [Math lessons](https://github.com/khan-mehran/baby-learning/blob/main/src/data/math.ts): `src/data/math.ts`
- [Urdu lessons](https://github.com/khan-mehran/baby-learning/blob/main/src/data/urdu.ts): `src/data/urdu.ts`
- [Knowledge lessons](https://github.com/khan-mehran/baby-learning/blob/main/src/data/gk.ts): `src/data/gk.ts`
- [Color themes](https://github.com/khan-mehran/baby-learning/blob/main/src/utils/colors.ts): `src/utils/colors.ts`

### Audio and install

- [Sound control](https://github.com/khan-mehran/baby-learning/blob/main/src/components/SoundToggle.tsx): `src/components/SoundToggle.tsx`
- [Mute preference](https://github.com/khan-mehran/baby-learning/blob/main/src/store/useAppStore.ts): `src/store/useAppStore.ts`
- [Speech playback](https://github.com/khan-mehran/baby-learning/blob/main/src/hooks/useAudio.ts): `src/hooks/useAudio.ts`
- [Install prompt](https://github.com/khan-mehran/baby-learning/blob/main/src/components/InstallCard.tsx): `src/components/InstallCard.tsx`
- [PWA integration](https://github.com/khan-mehran/baby-learning/blob/main/src/pwa.ts): `src/pwa.ts`
- [Offline worker](https://github.com/khan-mehran/baby-learning/blob/main/public/sw.js): `public/sw.js`

### Other components

- **Learner**
- **Browser speech**
- **Browser audio**
- **Local storage**

## Connections

- Learner → Route shell: opens (evidence: `src/App.tsx`)
- Route shell → Subject picker: routes to (evidence: `src/App.tsx`)
- Route shell → Knowledge categories: routes to (evidence: `src/App.tsx`)
- Route shell → Topic lesson: routes to (evidence: `src/App.tsx`)
- Subject picker → Subject cards: renders (evidence: `src/pages/HomePage.tsx`)
- Subject picker → Install prompt: renders (evidence: `src/pages/HomePage.tsx`)
- Subject picker → Knowledge categories: navigates to
- Subject picker → Topic lesson: navigates to
- Knowledge categories → Category cards: renders (evidence: `src/pages/GeneralKnowledgePage.tsx`)
- Knowledge categories → Topic lookup: reads categories (evidence: `src/pages/GeneralKnowledgePage.tsx`)
- Knowledge categories → Topic lesson: navigates to
- Topic lesson → Topic lookup: looks up topic (evidence: `src/pages/LearningPage.tsx`)
- Topic lesson → Lesson tabs: renders (evidence: `src/pages/LearningPage.tsx`)
- Topic lesson → Grid item: renders (evidence: `src/pages/LearningPage.tsx`)
- Topic lesson → Flashcard display: renders (evidence: `src/pages/LearningPage.tsx`)
- Topic lesson → Progress dots: renders (evidence: `src/pages/LearningPage.tsx`)
- Topic lesson → Sound control: renders (evidence: `src/pages/LearningPage.tsx`)
- Topic lookup → English lessons: includes (evidence: `src/data/index.ts`)
- Topic lookup → Math lessons: includes (evidence: `src/data/index.ts`)
- Topic lookup → Urdu lessons: includes (evidence: `src/data/index.ts`)
- Topic lookup → Knowledge lessons: includes (evidence: `src/data/index.ts`)
- English lessons → Color themes: uses colors (evidence: `src/data/english.ts`)
- Math lessons → Color themes: uses colors (evidence: `src/data/math.ts`)
- Urdu lessons → Color themes: uses colors (evidence: `src/data/urdu.ts`)
- Knowledge lessons → Color themes: uses colors (evidence: `src/data/gk.ts`)
- Subject picker → Sound control: renders (evidence: `src/pages/HomePage.tsx`)
- Sound control → Mute preference: reads mute state (evidence: `src/components/SoundToggle.tsx`)
- Sound control → Mute preference: toggles mute (evidence: `src/components/SoundToggle.tsx`)
- Mute preference → Local storage: persists preference (evidence: `src/store/useAppStore.ts`)
- Topic lesson → Speech playback: requests speech (evidence: `src/pages/LearningPage.tsx`)
- Speech playback → Mute preference: reads mute state (evidence: `src/hooks/useAudio.ts`)
- Speech playback → Browser speech: speaks text (evidence: `src/hooks/useAudio.ts`)
- Speech playback → Browser audio: plays recording (evidence: `src/hooks/useAudio.ts`)
- Install prompt → PWA integration: uses install support (evidence: `src/components/InstallCard.tsx`)
- Browser entry → Route shell: mounts app (evidence: `src/main.tsx`)
- Browser entry → PWA integration: initializes (evidence: `src/main.tsx`)
- PWA integration → Offline worker: may register
