An interactive, game-based phonics learning web app for ages 9-15. Built with Next.js, Firebase, and AI-powered features using Google's Gemini API.
https://alfredang.github.io/phonics-ai/
User guides for learners, teachers, and parents:
| Guide | Description |
|---|---|
| Home | Overview and quick start |
| For Learners | Student guide - games, XP, achievements |
| For Teachers | Classroom management, student progress tracking |
| For Parents | Link accounts, monitor child's progress |
| FAQ | Frequently asked questions |
Phonics AI helps students master English pronunciation through a structured learning journey:
- 5 Learning Worlds: Progress from basic letter sounds to fluent reading
- 44 Phonemes: Complete coverage of English sounds with IPA notation
- 4-Phase Lessons: Listen → Practice → Play → Assess
- Interactive Games: Phoneme Pop, Word Builder, Sound Match, and more
- Gamification: XP system, achievements, daily quests, and streaks
- Speech Features: Text-to-speech pronunciation and voice recording
- Visual Aids: Animated mouth positions for each sound
| Technology | Version | Purpose |
|---|---|---|
| Next.js | 14.2 | React framework with App Router |
| React | 18.3 | UI component library |
| TypeScript | 5.0 | Type-safe JavaScript |
| Technology | Version | Purpose |
|---|---|---|
| Tailwind CSS | 3.4 | Utility-first CSS framework |
| Framer Motion | 11.15 | Animation library |
| clsx | 2.1 | Conditional class names |
| tailwind-merge | 2.6 | Merge Tailwind classes |
| Technology | Version | Purpose |
|---|---|---|
| Zustand | 5.0 | Lightweight state management |
| Technology | Version | Purpose |
|---|---|---|
| Firebase Auth | 11.1 | User authentication |
| Cloud Firestore | 11.1 | NoSQL database |
| Firebase SDK | 11.1 | Firebase client library |
| Technology | Purpose |
|---|---|
| Google Gemini API | AI-powered features |
| Web Speech API | Text-to-speech & speech recognition |
| Technology | Purpose |
|---|---|
| ESLint | Code linting |
| PostCSS | CSS processing |
| GitHub Actions | CI/CD deployment |
| Platform | Purpose |
|---|---|
| GitHub Pages | Static site hosting |
| Next.js Static Export | Build output |
- Node.js 18+
- npm or yarn
- Firebase account
- Google AI Studio account (for Gemini API)
-
Clone the repository
git clone https://github.com/alfredang/phonics-ai.git cd phonics-ai -
Install dependencies
npm install
-
Set up environment variables
cp .env.example .env.local
-
Configure Firebase (see Firebase Setup below)
-
Run the development server
npm run dev
-
Open the app
Visit http://localhost:3000
- Go to Firebase Console
- Click "Create a project"
- Enter project name (e.g.,
phonics-ai) - Disable Google Analytics (optional)
- Click "Create project"
- In Firebase Console, click the Web icon (
</>) - Enter app nickname:
phonics-ai-web - Click "Register app"
- Copy the config values shown
- Go to Build → Authentication
- Click "Get started"
- Enable Email/Password provider
- Go to Build → Firestore Database
- Click "Create database"
- Select "Start in test mode"
- Choose a location closest to your users
- Click "Enable"
In Firestore → Rules tab, replace with:
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
match /users/{userId} {
allow read, write: if request.auth != null && request.auth.uid == userId;
}
match /gameStates/{userId} {
allow read, write: if request.auth != null && request.auth.uid == userId;
}
match /lessonProgress/{userId}/{document=**} {
allow read, write: if request.auth != null && request.auth.uid == userId;
}
}
}Click "Publish" to save.
Edit .env.local with your Firebase config:
NEXT_PUBLIC_FIREBASE_API_KEY=your_api_key
NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN=your_project.firebaseapp.com
NEXT_PUBLIC_FIREBASE_PROJECT_ID=your_project_id
NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET=your_project.appspot.com
NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID=your_sender_id
NEXT_PUBLIC_FIREBASE_APP_ID=your_app_id- Go to Google AI Studio
- Create an API key
- Add to
.env.local:NEXT_PUBLIC_GEMINI_API_KEY=your_gemini_api_key
The project is configured for GitHub Pages deployment via GitHub Actions.
-
Add GitHub Secrets
Go to your repo → Settings → Secrets → Actions, and add:
NEXT_PUBLIC_FIREBASE_API_KEYNEXT_PUBLIC_FIREBASE_AUTH_DOMAINNEXT_PUBLIC_FIREBASE_PROJECT_IDNEXT_PUBLIC_FIREBASE_STORAGE_BUCKETNEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_IDNEXT_PUBLIC_FIREBASE_APP_IDNEXT_PUBLIC_GEMINI_API_KEY
-
Enable GitHub Pages
Go to Settings → Pages → Source → Select "GitHub Actions"
-
Push to main branch
The workflow will automatically build and deploy.
npm run buildThe static site will be generated in the out/ directory.
src/
├── app/ # Next.js App Router pages
│ ├── (auth)/ # Auth pages (login, register)
│ ├── dashboard/ # Learner dashboard pages
│ │ ├── achievements/ # Achievements page
│ │ ├── games/ # Games hub and individual games
│ │ ├── profile/ # User profile page
│ │ ├── progress/ # Progress tracking page
│ │ ├── quests/ # Daily quests page
│ │ ├── settings/ # Settings page
│ │ └── worlds/ # Learning worlds and lessons
│ ├── teacher/ # Teacher dashboard (classroom management)
│ └── parent/ # Parent dashboard (child progress)
├── components/
│ ├── ui/ # Base UI components
│ ├── phonics/ # Phoneme display components
│ ├── audio/ # Audio/speech components
│ ├── games/ # Game components
│ ├── lesson/ # Lesson phase components
│ ├── sentences/ # Intonation training components
│ ├── chatbot/ # Phoni the helper chatbot
│ └── gamification/ # XP, achievements, quests
├── stores/ # Zustand state stores
├── lib/
│ ├── firebase/ # Firebase configuration & services
│ ├── audio/ # Audio utilities
│ └── ai/ # AI/Gemini integration
├── types/ # TypeScript type definitions
├── constants/ # Phonemes, lessons, worlds, sentences data
└── hooks/ # Custom React hooks
| World | Lessons | Focus | Phonemes Covered |
|---|---|---|---|
| 🔤 Letters Land | 20 | Individual sounds | Short/long vowels, consonants |
| 🏙️ Word City | 25 | Blending & digraphs | L-blends, R-blends, S-blends, digraphs |
| 📜 Rule Realm | 20 | Vowel patterns | R-controlled vowels, diphthongs |
| 🚂 Sentence Station | 15 | Fluency | Sentence-level reading |
| 👑 Story Kingdom | 15 | Comprehension | Paragraph & story reading |
Total: 95 lessons covering all 44 English phonemes
Each lesson follows a 4-phase pedagogical framework:
┌─────────────────────────────────────────────────────────────────────┐
│ 1. LISTEN 2. PRACTICE 3. PLAY 4. ASSESS │
│ ─────────── ──────────── ───────── ────────── │
│ • Hear phoneme • Record voice • Word games • Quiz time │
│ • See IPA • AI feedback • Match sounds • Earn stars │
│ • View tips • Get score • Score points • Unlock XP │
└─────────────────────────────────────────────────────────────────────┘
| Phase | Description |
|---|---|
| Listen | Students hear the phoneme and example words via TTS, see phoneme cards with IPA and mouth tips |
| Practice | Students speak words, AI analyzes pronunciation and provides personalized feedback |
| Play | Interactive games reinforce learning - match words to sounds |
| Assess | Quick quiz to demonstrate mastery, earn stars based on performance |
- Gemini AI Feedback: Intelligent analysis of student pronunciation
- Real-time Speech Recognition: Web Speech API captures student voice
- Contextual Tips: AI provides phoneme-specific improvement suggestions
- Adaptive Encouragement: Feedback adjusts based on attempt number and score
- 44 English phonemes with IPA notation
- Color-coded by category (vowels, consonants, digraphs)
- Animated mouth position guides
- Audio pronunciation with Web Speech API
- 95 structured lessons covering all sounds
- Visual Intonation Markers:
↗️ rising,↘️ falling, ➡️ sustained - Karaoke-style Text: Word-by-word highlighting synced with TTS
- Sentence Types: Statements, yes/no questions, wh-questions, exclamations
- Stress Indicators: Shows which words to emphasize
- AI Feedback: Evaluates pronunciation, fluency, and intonation patterns
- Phoneme Pop: Tap bubbles with the target sound
- Word Builder: Drag letter tiles to build words
- Sound Match: Memory matching with audio
- Sound Race: Speed-based phoneme identification
- Sentence Scramble: Arrange words in order
- Karaoke Challenge: Follow-along reading
- XP earned for completing lessons and games
- Level progression system
- Achievement badges (18 achievements across 4 categories)
- Daily quests with bonus XP rewards
- Streak tracking
- Progress: Track overall completion, world progress, and phoneme mastery
- Quests: View and complete daily challenges
- Achievements: Browse unlocked and locked badges
- Games: Practice any phoneme with standalone games
- Profile: View stats, level, and account information
- Settings: Customize audio, speech, display, and gameplay options
- Phoni the Owl 🦉: Cute chatbot helper available on every page
- Click the owl in the bottom-right corner to ask questions
- Get instant answers about lessons, games, XP, and app features
- Smart keyword matching for helpful responses
- Learners: Access lessons, games, track XP and achievements
- Teachers: Create classrooms, share join codes, monitor student progress
- Parents: Link to child accounts, view progress reports
| Command | Description |
|---|---|
npm run dev |
Start development server |
npm run build |
Build for production |
npm run start |
Start production server |
npm run lint |
Run ESLint |
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License.
- Phoneme data based on standard American English pronunciation
- Built with assistance from Claude AI