AI-powered math education platform with role-based access, gamification, and personalized learning paths. Built with React, TypeScript, Firebase, and FastAPI.
TypeScript
2
786 commits
updated Sep 23, 2026
The AI-powered math studio for Filipino Senior High STEM.
Personalized lessons. AI tutor. Quiz battles. Real-time class analytics.
Installable PWA + native Android, running on Firebase.
Live Demo • PWA • Download • Features • API • Contributing
Click the image above to open the live app on mathpulse-ai-2026.web.app — sign in with a 1-click demo account, no setup required.
Login mascot tracks the cursor — move left to right and the bot looks left to right.
MathPulse AI is an installable, gamified learning platform for SHS math — a free, repository-owned alternative to generic tutoring apps, purpose-built around the DepEd Strengthened SHS curriculum. Students get diagnostic assessments, AI-generated study plans, RAG-grounded lessons, and a 24/7 AI tutor. Teachers get at-risk detection and class analytics. Admins get platform-wide oversight and AI cost monitoring.
No install, no keys. Open the deploy and pick a demo account:
| Account | 1-Click login | Lands on |
|---|---|---|
| Student | teststudent@school.edu | Dashboard, Curriculum Modules, L.O.L.I. chat, Quiz Battle, Leaderboards |
| Teacher | testteacher@school.edu | Class dashboard (12 students, at-risk flags), Class Analytics, AI Quiz Maker, Data Import |
| Admin | testadmin@school.edu | Platform overview, User/Class Management, RAG Manager, AI Monitoring, Audit Log |
Screenshots in this README were captured from that deploy with Chrome DevTools (
docs/screenshots/, re-capture anytime withnode scripts/capture-readme-screenshots.mjs; login bot GIF withnode scripts/capture-login-bot-gif.mjs+ ffmpeg).
| Platform | Download |
|---|---|
| Web / PWA (any device) | Open live app, then Install from the browser or in-app install button |
| Android | Download APK (MathPulse-AI-debug.apk) |
| Self-host | docker compose up (frontend :3000 + backend :8000) |
Android details — Firebase-native (Auth, Firestore, Realtime DB), adaptive launcher icon, hardware back-button handling, edge-to-edge safe-area layout. Full guide: Android Setup & Release Guide.
PWA details — versioned app-shell service worker, offline fallback, conservative caching (no auth/API caching), iOS Add-to-Home-Screen guidance. Full guide: PWA docs.
Gamified home base: hero greeting with Continue Learning, Start Learning module cards with progress, Competency Matrix radar, Rewards & Achievements, Quiz Battle entry, and live Leaderboards — with the floating L.O.L.I. tutor one tap away.
Alt+K)
Mission control for a class: headcount, class average, engagement, and at-risk counts up top; AI insight banner calling out students falling behind; class cards with risk badges; calendar + live activity stream on the rail.
Platform-wide command deck: active students/teachers/classes, XP event volume, at-risk alerts, AI-vs-manual activity chart, model success-rate monitor with health check, top-performer mastery cards, and subject breakdowns.
dev / budget / prod) without redeploys| Model | Primary use |
|---|---|
| deepseek-chat | Global default: chat, verification, lesson/quiz generation, learning paths, daily insights, risk classification |
| deepseek-reasoner | Extended reasoning for complex RAG and curriculum search tasks |
Runtime routing (backend/services/inference_client.py) dispatches with fallback chains; profiles switchable live from the admin panel. Risk also has a supervised ML path (XGBoost/RandomForest, models/risk_classifier.joblib, trained via /api/predict-risk/train-model).
| Technology | Version | Purpose |
|---|---|---|
| React | 18.3.1 | UI framework, functional components + hooks |
| TypeScript | 5.9.3 | Strict-mode type safety, discriminated role types |
| Capacitor | 7.1.2 | Native Android/iOS bridge |
| Vite | 6.3.5 | Dev server, HMR, optimized builds |
| Tailwind CSS | 4.1.18 | Utility-first styling via @tailwindcss/vite |
| Radix UI | Latest | 48+ accessible component primitives |
| Motion | 12.38 | Animations, layout transitions |
| Recharts | 2.15.4 | Charts and analytics visuals |
| KaTeX | Latest | Math rendering (global CSS, tolerant parsing) |
| Zustand / TanStack Query | Latest / 5 | Client state / server state |
| Technology | Purpose |
|---|---|
| FastAPI + Uvicorn | 64-route Python API with OpenAPI docs, CORS, rate limiting |
| DeepSeek API | Inference via OpenAI-compatible client (prod profile: reasoner for RAG, chat elsewhere) |
Chroma + BAAI/bge-small-en-v1.5 | Curriculum vector store (datasets/vectorstore/, curriculum_chunks collection) |
| LiteParse | Local PDF/document parsing for ingestion and uploads |
| XGBoost / scikit-learn | Supervised risk classification with SHAP explanations |
| Technology | Purpose |
|---|---|
| Firebase Auth | Email/password + Google OAuth (mathpulse-ai-2026) |
| Cloud Firestore | All app data (users, progress, XP, chats, notifications) |
| Realtime Database | Quiz Battle matchmaking queue |
| Firebase Hosting | Production PWA hosting, SPA rewrites, PWA cache headers |
| Cloud Functions (Node 22) | Diagnostic processing, risk analysis, notifications, XP scoring |
| Docker / Nginx | Self-hosted production alternative |
Clone the repository
git clone https://github.com/Deign86/MATHPULSE-AI.git
cd MATHPULSE-AI
Install frontend dependencies
npm install
Configure environment variables — create .env.local:
# Firebase (required)
VITE_FIREBASE_API_KEY=your_api_key
VITE_FIREBASE_AUTH_DOMAIN=your_project.firebaseapp.com
VITE_FIREBASE_PROJECT_ID=your_project_id
VITE_FIREBASE_STORAGE_BUCKET=your_project.appspot.com
VITE_FIREBASE_MESSAGING_SENDER_ID=your_sender_id
VITE_FIREBASE_APP_ID=your_app_id
# DeepSeek API (required for AI features)
DEEPSEEK_API_KEY=your_deepseek_api_key
DEEPSEEK_BASE_URL=https://api.deepseek.com
# Backend API (optional — defaults to same-origin /api)
VITE_API_URL=/api
VITE_APP_VERSION=1.1.0-curriculum-sot
# Import-grounded generation flags (frontend)
VITE_ENABLE_IMPORT_GROUNDED_QUIZ=true
VITE_ENABLE_IMPORT_GROUNDED_LESSON=true
VITE_ENABLE_IMPORT_GROUNDED_FEEDBACK_EVENTS=true
VITE_ENABLE_ASYNC_GENERATION=true
Start the frontend dev server
npm run dev
Opens at http://localhost:5173.
Set up the backend (optional, for AI features)
cd backend
pip install -r requirements.txt
export DEEPSEEK_API_KEY=your_deepseek_api_key
uvicorn main:app --reload --host 0.0.0.0 --port 7860
Set
VITE_API_URL=http://127.0.0.1:8000when running FastAPI separately, or keep/apibehind the Docker/Nginx proxy.
npm run build # → build/
npx firebase deploy --only hosting # PWA → Firebase Hosting
npm run check:backend # pytest + mypy
npm run check:backend:dev # mypy only (fast, runs on predev)
npm run check:backend:quick # critical test file only
Mapped as a knowledge graph with GitNexus — 573 source files, 16,882 symbols, 26,955 relationships, 580 functional communities, 300 execution-flow chains. Deepest call chains (7–8 steps) run UI → API service → backend route → AI inference → Firestore.
| Metric | Value |
|---|---|
| Source files | 573 |
| Code symbols | 16,882 |
| Symbol relationships | 26,955 |
| Functional communities | 580 |
| Execution flow chains | 300 |
Key patterns — service-layer abstraction (components never touch Firestore directly), discriminated role types (StudentProfile | TeacherProfile | AdminProfile), AuthContext/ChatContext + onSnapshot realtime listeners, async task queue for heavy generation (POST /api/lesson|quiz/generate-async → GET /api/tasks/{id}).
Firestore collections — users/ (role-discriminated), progress/, xpActivities/, achievements/, notifications/, tasks/, chatSessions/, chatMessages/.
Cloud Functions (functions/src/) — diagnostic orchestration, rule-based risk analysis, notification fan-out, remedial quiz building, learning-path engine, IAR scoring, reassessment. Pre-deploy gates (pre_deploy_check.py, startup_validation.py) verify imports, env vars, config parsing, and inference-client init.
MATHPULSE-AI/
├── src/ # React frontend (components, services, stores, data, features)
├── backend/ # FastAPI (routes/, rag/, services/, tests/)
├── functions/ # Cloud Functions (automations, triggers, scoring)
├── android/ # Capacitor native wrapper
├── datasets/ # DepEd SSHS corpus + Chroma vector store
├── scripts/ # Gates, seeds, model sync, screenshot capture
├── docs/ # PWA, Android, contracts — plus docs/screenshots/
├── docker-compose.yml / Dockerfile / nginx.conf / firebase.json
The FastAPI backend exposes 64 routes across 15+ modules (interactive docs at /docs or /redoc when running):
| Route Module | Routes | Domain |
|---|---|---|
rag_routes.py | 8 | RAG lesson generation, health, document management |
class_analytics_routes.py | 6 | Class analytics, student views, topic performance |
class_records_router.py | 6 | SHS record upload, AI column detection, reports |
pipeline_routes.py | 5 | Student intelligence pipeline, nudges, recompute |
admin_routes.py | 4 | Admin PDF upload/reingest, school analytics |
intervention_routes.py | 3 | Intervention plans, stepped guides, PDF export |
deepseek_rag_routes.py | 3 | Weakness detection, module previews, study tips |
quiz_battle.py | 3 | Quiz battle ingestion, bank status, results |
practice.py | 3 | Practice generation, submission, stats, history |
diagnostic.py | 1 | Full diagnostic + RAG analysis |
risk_router.py | 2 | Risk computation (single + batch) |
quiz_generation_routes.py | 1 | AI quiz generation |
ai_monitoring.py | 2 | DeepSeek monitoring + cost tracking |
| Method | Endpoint | Description |
|---|---|---|
GET | /health | Health check with model status |
POST | /api/chat / /api/chat/stream | AI tutor conversation (SSE streaming) |
POST | /api/verify-solution | Multi-method math solution verification |
POST | /api/predict-risk | Risk classification (DeepSeek structured output) |
POST | /api/predict-risk/enhanced | ML risk scoring + LLM interventions |
POST | /api/learning-path | Personalized path from weaknesses |
POST | /api/analytics/daily-insight | Daily teacher-dashboard insights |
POST | /api/lesson/generate | Import-grounded lesson plans |
POST | /api/quiz/generate | Curriculum/grounded quiz sets |
POST | `/api/lesson | quiz/generate-async` |
GET | /api/tasks/{task_id} | Poll async task status/result |
POST | /api/upload/class-records | CSV/XLSX/PDF upload + AI column detection |
POST | /api/automation/diagnostic-completed | Post-diagnostic workflow trigger |
GET | /api/admin/model-config | Model config + profiles |
POST | /api/admin/model-config/profile | Switch profile (dev/budget/prod) |
Math verification pipeline — self-consistency (3 samples, agreement-scored), sandboxed Python code verification, and a low-temperature LLM judge.
| Feature | Details |
|---|---|
| XP Rewards | Fixed XP per action (e.g., 50 XP per lesson) |
| Daily Check-In | 7-day cycle, escalating XP (20 → 100 XP) + streak bonuses |
| Leveling | Exponential curve: XP_needed = 100 × 1.5^(level − 1) |
| Streaks | Daily login tracking (5 XP × streak days, max 50) |
| Achievements | 12+ unlockable milestones |
| Leaderboard | Global and section-based rankings |
docker compose up # dev: hot reload frontend + backend
docker compose --profile prod up # prod: Nginx serving optimized build
docker compose down # stop
| Service | Port | Description |
|---|---|---|
| Frontend (dev) | 3000 | Vite dev server |
| Backend | 8000 | FastAPI (container :7860) |
| Production | 80 | Nginx production build |
git checkout -b feature/amazing-feature)git commit -m 'Add amazing feature')git push origin feature/amazing-feature)Conventions — PascalCase components in src/components/, camelCase services in src/services/, shared types in src/types/models.ts, Tailwind utilities (mobile-first), all API calls through src/services/apiService.ts + src/config/env.ts.
MIT — see LICENSE.
TypeScript
68.5%
Python
29.5%
JavaScript
1.4%
AI-powered math education platform with role-based access, gamification, and personalized learning paths. Built with React, TypeScript, Firebase, and FastAPI.
TypeScript
2
786 commits
updated Sep 23, 2026
The AI-powered math studio for Filipino Senior High STEM.
Personalized lessons. AI tutor. Quiz battles. Real-time class analytics.
Installable PWA + native Android, running on Firebase.
Live Demo • PWA • Download • Features • API • Contributing
Click the image above to open the live app on mathpulse-ai-2026.web.app — sign in with a 1-click demo account, no setup required.
Login mascot tracks the cursor — move left to right and the bot looks left to right.
MathPulse AI is an installable, gamified learning platform for SHS math — a free, repository-owned alternative to generic tutoring apps, purpose-built around the DepEd Strengthened SHS curriculum. Students get diagnostic assessments, AI-generated study plans, RAG-grounded lessons, and a 24/7 AI tutor. Teachers get at-risk detection and class analytics. Admins get platform-wide oversight and AI cost monitoring.
No install, no keys. Open the deploy and pick a demo account:
| Account | 1-Click login | Lands on |
|---|---|---|
| Student | teststudent@school.edu | Dashboard, Curriculum Modules, L.O.L.I. chat, Quiz Battle, Leaderboards |
| Teacher | testteacher@school.edu | Class dashboard (12 students, at-risk flags), Class Analytics, AI Quiz Maker, Data Import |
| Admin | testadmin@school.edu | Platform overview, User/Class Management, RAG Manager, AI Monitoring, Audit Log |
Screenshots in this README were captured from that deploy with Chrome DevTools (
docs/screenshots/, re-capture anytime withnode scripts/capture-readme-screenshots.mjs; login bot GIF withnode scripts/capture-login-bot-gif.mjs+ ffmpeg).
| Platform | Download |
|---|---|
| Web / PWA (any device) | Open live app, then Install from the browser or in-app install button |
| Android | Download APK (MathPulse-AI-debug.apk) |
| Self-host | docker compose up (frontend :3000 + backend :8000) |
Android details — Firebase-native (Auth, Firestore, Realtime DB), adaptive launcher icon, hardware back-button handling, edge-to-edge safe-area layout. Full guide: Android Setup & Release Guide.
PWA details — versioned app-shell service worker, offline fallback, conservative caching (no auth/API caching), iOS Add-to-Home-Screen guidance. Full guide: PWA docs.
Gamified home base: hero greeting with Continue Learning, Start Learning module cards with progress, Competency Matrix radar, Rewards & Achievements, Quiz Battle entry, and live Leaderboards — with the floating L.O.L.I. tutor one tap away.
Alt+K)
Mission control for a class: headcount, class average, engagement, and at-risk counts up top; AI insight banner calling out students falling behind; class cards with risk badges; calendar + live activity stream on the rail.
Platform-wide command deck: active students/teachers/classes, XP event volume, at-risk alerts, AI-vs-manual activity chart, model success-rate monitor with health check, top-performer mastery cards, and subject breakdowns.
dev / budget / prod) without redeploys| Model | Primary use |
|---|---|
| deepseek-chat | Global default: chat, verification, lesson/quiz generation, learning paths, daily insights, risk classification |
| deepseek-reasoner | Extended reasoning for complex RAG and curriculum search tasks |
Runtime routing (backend/services/inference_client.py) dispatches with fallback chains; profiles switchable live from the admin panel. Risk also has a supervised ML path (XGBoost/RandomForest, models/risk_classifier.joblib, trained via /api/predict-risk/train-model).
| Technology | Version | Purpose |
|---|---|---|
| React | 18.3.1 | UI framework, functional components + hooks |
| TypeScript | 5.9.3 | Strict-mode type safety, discriminated role types |
| Capacitor | 7.1.2 | Native Android/iOS bridge |
| Vite | 6.3.5 | Dev server, HMR, optimized builds |
| Tailwind CSS | 4.1.18 | Utility-first styling via @tailwindcss/vite |
| Radix UI | Latest | 48+ accessible component primitives |
| Motion | 12.38 | Animations, layout transitions |
| Recharts | 2.15.4 | Charts and analytics visuals |
| KaTeX | Latest | Math rendering (global CSS, tolerant parsing) |
| Zustand / TanStack Query | Latest / 5 | Client state / server state |
| Technology | Purpose |
|---|---|
| FastAPI + Uvicorn | 64-route Python API with OpenAPI docs, CORS, rate limiting |
| DeepSeek API | Inference via OpenAI-compatible client (prod profile: reasoner for RAG, chat elsewhere) |
Chroma + BAAI/bge-small-en-v1.5 | Curriculum vector store (datasets/vectorstore/, curriculum_chunks collection) |
| LiteParse | Local PDF/document parsing for ingestion and uploads |
| XGBoost / scikit-learn | Supervised risk classification with SHAP explanations |
| Technology | Purpose |
|---|---|
| Firebase Auth | Email/password + Google OAuth (mathpulse-ai-2026) |
| Cloud Firestore | All app data (users, progress, XP, chats, notifications) |
| Realtime Database | Quiz Battle matchmaking queue |
| Firebase Hosting | Production PWA hosting, SPA rewrites, PWA cache headers |
| Cloud Functions (Node 22) | Diagnostic processing, risk analysis, notifications, XP scoring |
| Docker / Nginx | Self-hosted production alternative |
Clone the repository
git clone https://github.com/Deign86/MATHPULSE-AI.git
cd MATHPULSE-AI
Install frontend dependencies
npm install
Configure environment variables — create .env.local:
# Firebase (required)
VITE_FIREBASE_API_KEY=your_api_key
VITE_FIREBASE_AUTH_DOMAIN=your_project.firebaseapp.com
VITE_FIREBASE_PROJECT_ID=your_project_id
VITE_FIREBASE_STORAGE_BUCKET=your_project.appspot.com
VITE_FIREBASE_MESSAGING_SENDER_ID=your_sender_id
VITE_FIREBASE_APP_ID=your_app_id
# DeepSeek API (required for AI features)
DEEPSEEK_API_KEY=your_deepseek_api_key
DEEPSEEK_BASE_URL=https://api.deepseek.com
# Backend API (optional — defaults to same-origin /api)
VITE_API_URL=/api
VITE_APP_VERSION=1.1.0-curriculum-sot
# Import-grounded generation flags (frontend)
VITE_ENABLE_IMPORT_GROUNDED_QUIZ=true
VITE_ENABLE_IMPORT_GROUNDED_LESSON=true
VITE_ENABLE_IMPORT_GROUNDED_FEEDBACK_EVENTS=true
VITE_ENABLE_ASYNC_GENERATION=true
Start the frontend dev server
npm run dev
Opens at http://localhost:5173.
Set up the backend (optional, for AI features)
cd backend
pip install -r requirements.txt
export DEEPSEEK_API_KEY=your_deepseek_api_key
uvicorn main:app --reload --host 0.0.0.0 --port 7860
Set
VITE_API_URL=http://127.0.0.1:8000when running FastAPI separately, or keep/apibehind the Docker/Nginx proxy.
npm run build # → build/
npx firebase deploy --only hosting # PWA → Firebase Hosting
npm run check:backend # pytest + mypy
npm run check:backend:dev # mypy only (fast, runs on predev)
npm run check:backend:quick # critical test file only
Mapped as a knowledge graph with GitNexus — 573 source files, 16,882 symbols, 26,955 relationships, 580 functional communities, 300 execution-flow chains. Deepest call chains (7–8 steps) run UI → API service → backend route → AI inference → Firestore.
| Metric | Value |
|---|---|
| Source files | 573 |
| Code symbols | 16,882 |
| Symbol relationships | 26,955 |
| Functional communities | 580 |
| Execution flow chains | 300 |
Key patterns — service-layer abstraction (components never touch Firestore directly), discriminated role types (StudentProfile | TeacherProfile | AdminProfile), AuthContext/ChatContext + onSnapshot realtime listeners, async task queue for heavy generation (POST /api/lesson|quiz/generate-async → GET /api/tasks/{id}).
Firestore collections — users/ (role-discriminated), progress/, xpActivities/, achievements/, notifications/, tasks/, chatSessions/, chatMessages/.
Cloud Functions (functions/src/) — diagnostic orchestration, rule-based risk analysis, notification fan-out, remedial quiz building, learning-path engine, IAR scoring, reassessment. Pre-deploy gates (pre_deploy_check.py, startup_validation.py) verify imports, env vars, config parsing, and inference-client init.
MATHPULSE-AI/
├── src/ # React frontend (components, services, stores, data, features)
├── backend/ # FastAPI (routes/, rag/, services/, tests/)
├── functions/ # Cloud Functions (automations, triggers, scoring)
├── android/ # Capacitor native wrapper
├── datasets/ # DepEd SSHS corpus + Chroma vector store
├── scripts/ # Gates, seeds, model sync, screenshot capture
├── docs/ # PWA, Android, contracts — plus docs/screenshots/
├── docker-compose.yml / Dockerfile / nginx.conf / firebase.json
The FastAPI backend exposes 64 routes across 15+ modules (interactive docs at /docs or /redoc when running):
| Route Module | Routes | Domain |
|---|---|---|
rag_routes.py | 8 | RAG lesson generation, health, document management |
class_analytics_routes.py | 6 | Class analytics, student views, topic performance |
class_records_router.py | 6 | SHS record upload, AI column detection, reports |
pipeline_routes.py | 5 | Student intelligence pipeline, nudges, recompute |
admin_routes.py | 4 | Admin PDF upload/reingest, school analytics |
intervention_routes.py | 3 | Intervention plans, stepped guides, PDF export |
deepseek_rag_routes.py | 3 | Weakness detection, module previews, study tips |
quiz_battle.py | 3 | Quiz battle ingestion, bank status, results |
practice.py | 3 | Practice generation, submission, stats, history |
diagnostic.py | 1 | Full diagnostic + RAG analysis |
risk_router.py | 2 | Risk computation (single + batch) |
quiz_generation_routes.py | 1 | AI quiz generation |
ai_monitoring.py | 2 | DeepSeek monitoring + cost tracking |
| Method | Endpoint | Description |
|---|---|---|
GET | /health | Health check with model status |
POST | /api/chat / /api/chat/stream | AI tutor conversation (SSE streaming) |
POST | /api/verify-solution | Multi-method math solution verification |
POST | /api/predict-risk | Risk classification (DeepSeek structured output) |
POST | /api/predict-risk/enhanced | ML risk scoring + LLM interventions |
POST | /api/learning-path | Personalized path from weaknesses |
POST | /api/analytics/daily-insight | Daily teacher-dashboard insights |
POST | /api/lesson/generate | Import-grounded lesson plans |
POST | /api/quiz/generate | Curriculum/grounded quiz sets |
POST | `/api/lesson | quiz/generate-async` |
GET | /api/tasks/{task_id} | Poll async task status/result |
POST | /api/upload/class-records | CSV/XLSX/PDF upload + AI column detection |
POST | /api/automation/diagnostic-completed | Post-diagnostic workflow trigger |
GET | /api/admin/model-config | Model config + profiles |
POST | /api/admin/model-config/profile | Switch profile (dev/budget/prod) |
Math verification pipeline — self-consistency (3 samples, agreement-scored), sandboxed Python code verification, and a low-temperature LLM judge.
| Feature | Details |
|---|---|
| XP Rewards | Fixed XP per action (e.g., 50 XP per lesson) |
| Daily Check-In | 7-day cycle, escalating XP (20 → 100 XP) + streak bonuses |
| Leveling | Exponential curve: XP_needed = 100 × 1.5^(level − 1) |
| Streaks | Daily login tracking (5 XP × streak days, max 50) |
| Achievements | 12+ unlockable milestones |
| Leaderboard | Global and section-based rankings |
docker compose up # dev: hot reload frontend + backend
docker compose --profile prod up # prod: Nginx serving optimized build
docker compose down # stop
| Service | Port | Description |
|---|---|---|
| Frontend (dev) | 3000 | Vite dev server |
| Backend | 8000 | FastAPI (container :7860) |
| Production | 80 | Nginx production build |
git checkout -b feature/amazing-feature)git commit -m 'Add amazing feature')git push origin feature/amazing-feature)Conventions — PascalCase components in src/components/, camelCase services in src/services/, shared types in src/types/models.ts, Tailwind utilities (mobile-first), all API calls through src/services/apiService.ts + src/config/env.ts.
MIT — see LICENSE.
TypeScript
68.5%
Python
29.5%
JavaScript
1.4%