Noether Math

← Back to Projects

A gamified platform for learning math by doing math — step-by-step derivation input, symbolic equivalence checking, a Socratic AI tutor, and RPG progression on top of a real curriculum.

Named after Emmy Noether. Instead of asking for a final answer and grading a string, Noether Math asks students to write out each intermediate algebraic step, checks that every step is symbolically equivalent to the last and actually follows from it, and only marks a problem solved when the work reaches a genuinely solved form. A tutor named Hypatia sits alongside the workspace and gives Socratic hints — pointing at the step where things went wrong, naming a relevant rule — without ever completing the step.


1. Problem Statement

The failure mode this targets is familiar: you watch the videos, follow along, feel like you understand — and then can’t solve a problem on your own. Passive video and final-answer graders don’t build the muscle of producing a derivation.

Boot.dev demonstrated that deep, hands-on, gamified practice works well for programming education. Noether Math adapts that pedagogy to mathematics, where the verification problem is harder (many valid solution paths, equations rather than text) and the payoff — being able to actually do the math — is arguably higher.


2. How It Works

A lesson is: theory → guided derivation → verified completion.

  • Each lesson opens with a short theory page. You move to the workspace only after reading it.
  • In the workspace you enter math through a structured equation editor (MathLive) — never raw LaTeX. A symbol keypad covers integrals, sums, fractions, exponents.
  • You build the derivation one step at a time. Each step is checked two ways: it must be symbolically equivalent to the previous step, and it must chain from it (not just happen to match the original target). Re-typing the starting expression never counts as progress.
  • Completion requires reaching a solved form, not merely an equivalent expression. For “reach this specific form” lessons a goal is shown; for most lessons the target is hidden so it can’t be reverse-engineered.
  • Hypatia, the AI tutor, reads the lesson context and every step you’ve entered so far. Her system prompt forbids giving answers, doing arithmetic for you, or stating “this equals” — she asks guiding questions and points at the error. Asking her for help costs XP unless you spend an Abacus item.

Onboarding runs an adaptive placement test that routes you to the right course and unlocks chapters you’ve effectively tested out of.


3. Gamification

Rewards are earned by solving, not by clicking through: XP with a 10-tier title ladder (Novice → Algebraist → Geometer → … → Euler Initiate), daily streaks with an “ember” grace mechanic (a Frozen Flame item auto-consumes to save a streak on a missed day), a gems economy feeding a shop of consumables, daily/weekly quests, randomized loot chests, weekly leagues with a live leaderboard, boss battles, and a spaced-repetition flashcard deck (SM-2) auto-populated from completed lessons. A first-attempt “Euler’s Run” bonus rewards getting a derivation right with no wrong steps.

All reward numbers, prices, and thresholds live in one shared lib/constants.ts, not inline in components.


4. System Architecture

graph TD W[Web\nReact 19 + Vite] --> API RN[Mobile\nReact Native, Expo — frozen] --> API AND[Android\nweb build wrapped with Capacitor] --> API API[Go modular monolith\nstdlib net-http — Cloud Run, scale-to-zero] API --> PG[(PostgreSQL on Neon\nRow-Level Security)] API --> AI[Vertex AI Gemini\nADC auth, no static keys] FB[Firebase Auth\nGoogle OAuth, email/password] -->|JWT| API API -.->|verifies token against| JWKS[Google JWKS endpoint\nRS256, keys cached 1h] RTDB[Firebase Realtime DB\nlive leaderboards] --> W

Three clients share one backend. Everything falls back to mocks or localhost when env vars are unset, so all three apps run with zero configuration for local development.


5. Tech Stack

Layer Choice
Web React 19, Vite, TypeScript, Tailwind CSS v4, Zustand, React Router v6
Math MathJS (numeric), SymPy via Pyodide/WASM (symbolic), KaTeX (render), MathLive (input), function-plot (graphs) — all npm-bundled, no CDN
Mobile React Native + Expo, expo-router, MMKV (frozen)
Android shell Capacitor + @capacitor-firebase/authentication
Backend Go modular monolith, stdlib net/http + lib/pq only, Google Cloud Run
Database PostgreSQL on Neon, Row-Level Security via injected session context
Auth Firebase Auth, JWT verified in-process against Google’s JWKS
Realtime Firebase Realtime Database (leaderboards)
AI tutor Vertex AI Gemini, IAM/ADC auth (no static keys)
IaC Terraform

6. Key Engineering Decisions

Dual-path math verification. Homework is verified entirely client-side, in Web Workers: a fast numeric pass (MathJS evaluated at multiple random test points, tolerance 1e-9) and a symbolic pass (SymPy compiled to WASM via Pyodide, preloaded in the background during onboarding). Zero server compute, sub-second feedback; results sync to the backend afterward. Exams take the opposite path — validated only server-side in the Go container — so a student can’t spoof progress by intercepting a client-side check. The rule is: never move exam validation to the client.

Row-Level Security without a PostgREST layer. Supabase gives you JWT-claims → DB-session mapping for free; Neon doesn’t. The Go backend wraps every query in a transaction that runs SELECT set_config('app.current_user_id', $1, true) — the third argument true makes the setting transaction-local, so a user’s identity can’t leak to the next request on a pooled connection. RLS policies read that setting via an auth.uid() SQL function. This kept database-level security intact without rewriting tables when the stack moved off Supabase.

Keeping the AI genuinely Socratic. Beyond the system-prompt constraints, non-leakage is enforced structurally: hidden targets are never plotted or shown before completion, Hypatia’s offline fallback is gated so it can’t reveal the goal, and AI help has an XP cost. Adversarial-prompt testing is on the risk register.

Per-user anti-cheat. Lesson coefficients are randomized per user, seeded from HMAC(user_id + lesson_id), so two students can’t just swap final answers.

Cost-driven infrastructure. The stack started on Supabase + Netlify, moved to GCP-native to burn startup credits and control egress cost at scale, then moved Postgres from Cloud SQL to Neon to cut roughly ₹1000/month of always-on spend before credits expire. Scale-to-zero everywhere the traffic allows it.

Android: wrap the web app, don’t port it. The React Native app is real and substantially built, but the lesson-UX overhaul (theory pages, chain-step validation, in-workspace graphs) depends on browser-only libraries — function-plot and MathLive. Catching the RN app up would mean a second implementation against different libraries plus re-auditing the answer-leak risk from scratch. Capacitor ships the exact code already running on web, so the RN app was frozen rather than maintained in parallel.


7. Current Status

Built end-to-end for the web MVP: sign-up, adaptive placement, curriculum map, theory + derivation workspace, two-layer symbolic grading, the real Vertex AI tutor, daily streaks with the item mechanic, live Firebase leaderboard, gem shop, quests, loot chests, and a subscription paywall gating content past the free chapters. Curriculum content covers a College Algebra course, a Calculus 1 course, and a ~74-lesson Pre-Calculus course.

It’s deployed and live, but in a testing / dev-facing state — not yet promoted for public sign-ups. Not yet claimed:

  • Payments are mocked. The paywall and upgrade UI are real; checkout is a mock — Stripe and Google Play Billing were researched but deferred.
  • Android build is unfinished. The Capacitor shell is scaffolded; it still needs Firebase Android app registration, an app icon, and on-device verification.
  • The React Native app is frozen and unsafe to ship to new users — it predates the lesson-UX overhaul and still leaks lesson goals.
  • Test coverage is light. The web app has a Vitest suite for the equivalence engine and level/XP logic plus a few Playwright E2E flows; the Go backend has no tests.

8. What’s Next

  • Close the mobile parity debt or fully commit to the Capacitor path and delete the RN app.
  • Wire real billing (Stripe on web, Play Billing via Capacitor on Android).
  • Backend test coverage, especially around XP/streak/quest award logic and the RLS session wrapper.
  • Finish and verify the Android build; then a small closed beta.