📚 Micro Learning Platform

# Falah Mobile — Handover

Complete E2E system for browsing, purchasing, consuming, and certifying bite-sized (5 min) courses derived from books.

Repository `git.falahos.my/wmj/falah-mobile.git` · Source `/root/falah-mobile` · Branch `main` · Commit `bfd3509` · GitHub `maifors/falah-mobile`
📊

## Phase 1 Complete — Live in Production

Production: falahos.my/mobile · Staging: falahos.my:4014/mobile

Deployment Docker + Traefik
Host Contabo VPS (Ubuntu 24.04)
Auth Ummah ID (JWT)
Payments Polar.sh
✅

## Courses Built

4
Courses Live
21
Modules
6
Categories
35
Courses Left
Atomic Habits Defining Decade Simplicity Parenting Tao Te Ching
Library completion 4 / 39 courses (10%)

All 4 in Self Improvement. Quran, Hadith, Prayer, History, Finance categories empty — ready for content.

🎓

## Delivery Features

- ✦ Course catalog — search bar + category filter tabs
- ✦ Module reader — markdown content + progress bar + quiz badges
- ✦ TTS audio — Web Speech API, Google UK English Female (preferred)
- ✦ Markdown stripping — 11 patterns clean text for TTS
- ✦ Quiz system — 3–5 MCQs per module, submit/score/retry
- ✦ Certificate issuance — auto-issued on 100% completion, PDF + serial

💳

## Payments & Subscription

- ✦ $9.99/mo Learn Pass Monthly ✅ Live
- ✦ $79.99/yr Learn Pass Annual ✅ Live
- ✦ $4.99 each One-time course purchases ❌ Not mapped
- ⚠ Action: Add Polar price IDs for 4 new courses to `checkout/route.ts` PRODUCTS map

📋

## Priority Backlog

- ✦ 35 more courses — build & seed across 6 categories
- ✦ Checkout mapping — Polar price IDs for each new course
- ✦ Course thumbnails — replace emoji/gradient with real cover art
- ✦ Gitea sync — test course sync script
- ✦ Server-side TTS — Azure / ElevenLabs for higher quality
- ✦ Admin dashboard — course management UI
- ✦ Analytics — completion rates, quiz scores

📦

## Tech Stack

Next.js 16 TypeScript SQLite Prisma v5.22 Tailwind CSS Polar.sh Docker Traefik Web Speech API Gitea

Database

SQLite (`/app/data/dev.db`) via Prisma ORM

Schema: `prisma/schema.prisma`

Deployment

Source → `npm run build` → Docker → Traefik reverse proxy

Host: Contabo VPS

🏗

## Route Architecture

# Next.js App Router — basePath: "/mobile"
GET /mobile/learn ← Course catalog (search + category tabs)
GET /mobile/learn/[slug] ← Course detail + module timeline
GET /mobile/learn/[slug]/[moduleId] ← Module reader + TTS + Quiz
GET /mobile/api/learn/courses ← ?category=&search=
GET /mobile/api/learn/courses/[slug] ← Course detail API
GET /mobile/api/learn/categories ← List categories
POST /mobile/api/learn/checkout ← Polar.sh checkout
POST /mobile/api/learn/progress ← Mark module complete + auto-certificate
GET /mobile/api/learn/certificates ← User certificates
POST /mobile/api/learn/sync ← Gitea sync

Key Source Files (26 files)

prisma/schema.prisma learn/page.tsx [slug]/page.tsx checkout/route.ts progress/route.ts courses/route.ts lib/learn.ts Dockerfile LearnPassCard.tsx
⚙️

## Common Commands

$ cd /root/falah-mobile
$ npm run build
$ docker build -t falah-mobile:latest .
$ docker compose up -d --no-deps falah-mobile
$ npx prisma db push

DB ops via `docker cp` + `sqlite3` for quick data fixes

🐛

## Known Issues

- #1 🟡 Health check slow — 30s+ but API works immediately
- #2 🟡 .env permission error — `EACCES` in logs (env still loads correctly)
- #3 🔴 Checkout missing courses — Only 3 old courses in PRODUCTS map
- #4 🟡 Staging DB sharing — prod & staging share same volume
- #5 🟢 Missing thumbnails — emoji/gradient placeholders
- #6 🟢 Course card navigation — `stopPropagation` edge case

Low Medium High