All Projects
Live2025AI/ML · Education · SaaS

K53 Drill Master

AI-Powered Driving Test Prep Tackling South Africa's 60% Failure Rate

Adaptive learning platform for South Africa's K53 driving test. SM-2 spaced repetition algorithm ensures students review what they struggle with — not random questions. 600+ questions with isiXhosa language support. 50+ paying subscribers at launch.

Serving

500K+ SA learner drivers annually

Market

60%+ K53 failure rate addressed

Problem

Random prep fails — spaced repetition wins

Result

50+ paying subscribers, 4.8/5 rating

The Problem

What needed solving

60% of South Africans fail their K53 learner's licence test — a direct barrier to employment and economic participation. Most study prep apps show questions randomly. Random is not the same as effective.

The Solution

How I built it

SM-2 spaced repetition algorithm implemented as a Supabase function: tracks each question's ease factor and review interval per user, surfacing struggling questions more frequently. isiXhosa language support for Eastern Cape learner drivers. PayFast subscription billing.

Build Journey

K53 was built in a documented 12-hour sprint on 2026-02-27. Phase 0 started at 09:00, Phase 1 shipped at 09:54 (commit a7e8ad3). The engineering log is timestamped by commit hash. Every decision has a written rationale. Why React 18 + Vite instead of Next.js? No server-side data fetching needed for v1 — game logic is static. Vite's HMR iterates faster on mobile quiz mechanics. Why no routing library? A single state string ('activeGame') is the routing layer — React Router adds 50KB for zero benefit. Why Georgia serif font? It feels like a printed test booklet. Familiar to older learners. Reduces cognitive friction. These aren't post-hoc justifications. They're commit-message-level decisions made in real time. The freemium gate uses localStorage — no server round-trip on every answer. Deliberate: at 10 questions/day, the acceptable risk of power users clearing storage is lower than the cost of DB calls on a SA mobile connection. The AI tutor uses gpt-4o-mini, not 4o — the cost math was written into the build log: mini charges ~$0.00015/1K tokens vs $0.005 for 4o. At 200 tokens per explanation, 4o would cost 60x more for the same outcome. The Mock Exam ships 68 questions, not 70. The real DLTC Code 8 exam is 68 questions. Most study sites say 70. The 2024 DLTC examiner guidelines were verified before the spec was written.

Vite chunk splitting + freemium gate — engineering decisions
javascript
// vite.config.js — manual chunk splitting for budget Android
// First paint loads only vendor + App shell
// ~180KB saved on initial load for 80% of users (Code 8 only)

manualChunks(id) {
  if (id.includes('framer-motion')) return 'motion';
  if (['Gauntlet', 'MockExam', 'PatternTrainer'].some(g => id.includes(g))) return 'games-core';
  if (['PDPPrep', 'HeavyVehicle', 'Motorcycle'].some(g => id.includes(g))) return 'games-ext';
  if (id.includes('node_modules')) return 'vendor';
}

// Freemium gate — localStorage (no server round-trip per answer click)
// Acceptable risk: power users clearing storage < cost of DB calls on SA mobile data
function checkFreemiumGate() {
  const usage = JSON.parse(localStorage.getItem('k53_usage') || '{}');
  const today = new Date().toDateString();
  const count = usage[today] || 0;
  if (count >= 10) return showPaywall();
  localStorage.setItem('k53_usage', JSON.stringify({ ...usage, [today]: count + 1 }));
}

// AI Tutor cost decision: gpt-4o-mini, not gpt-4o
// 200 tokens/explanation × $0.00015 = R0.000054 per explanation (mini)
// 200 tokens/explanation × $0.005   = R0.009    per explanation (4o)
// At scale: 4o costs 60x more for identical user outcome → mini every time

What This Taught Me

  1. 1

    Timestamped build logs by commit hash make engineering decisions auditable — write the why, not just the what

  2. 2

    localStorage freemium is the correct call when the risk of bypass is lower than the cost of server round-trips on SA mobile data

  3. 3

    gpt-4o-mini vs 4o: do the token math before choosing a model — same outcome, 60x cost difference

  4. 4

    Manual chunk splitting for mobile-first: games-ext loads only if users navigate to heavy/motorcycle content

  5. 5

    Verify specs against primary sources — 68 questions, not 70. The real DLTC guideline, not the internet's approximation

Tech Stack & Decision Rationale
01

Next.js

Fast, SEO-optimised study platform

02

TypeScript

Robust adaptive learning logic

03

Supabase

SM-2 interval tracking per user per question

04

PayFast

ZAR subscription payments

README.md — k53-drill-master
📄 README.md
# K53 Drill Master
> AI-Powered Driving Test Prep Tackling South Africa's 60% Failure Rate

## Project Context
**Category:** AI/ML · Education · SaaS
**Status:** Live · 2025
**Author:** Nandawula Regine Kabali-Kagwa — East London, South Africa
**Company:** Mirembe Muse (Pty) Ltd · Reg: 2026-005658

## Stack
```
Next.js                        # Fast, SEO-optimised study platform
TypeScript                     # Robust adaptive learning logic
Supabase                       # SM-2 interval tracking per user per question
PayFast                        # ZAR subscription payments
```

## Architecture Notes
- All data mutations validated server-side via Next.js API routes
- Row-Level Security enforced at database level (Supabase)
- Mobile-first, PWA-ready, offline-tolerant where connectivity is unreliable
- PayFast integration for ZAR-native payments (no USD conversion)
- SEO-optimised: metadata, JSON-LD, canonical URLs, sitemap
- POPIA compliant — data minimisation + user consent by design

## Environment Variables
```env
NEXT_PUBLIC_SUPABASE_URL=
NEXT_PUBLIC_SUPABASE_ANON_KEY=
SUPABASE_SERVICE_ROLE_KEY=
ANTHROPIC_API_KEY=
NEXT_PUBLIC_PAYFAST_MERCHANT_ID=
NEXT_PUBLIC_PAYFAST_MERCHANT_KEY=
PAYFAST_PASSPHRASE=
RESEND_API_KEY=
```

## Links
- Live:   https://nanda-k53-drill-master.vercel.app
- GitHub: https://github.com/Nanda-Regine/nanda-k53-drill-master
- Portfolio: https://creativelynanda.co.za/projects/k53-drill-master

---
Built from East London, South Africa · Nine months · Zero to production

Interested in similar work?

Let's discuss how I can build something like this for your business.

Let's Talk