Lighthouse Bible Quiz
Learn it; Live it; Share it — live and daily Bible quizzes for every age
Lighthouse Bible Quiz is a mobile app for learning Scripture through play: monthly live quizzes with prizes, daily quizzes and verses, memory-verse recitation, VersePlay word games, streaks, crowns and leaderboards. I led the v6 backend — a ground-up NestJS rewrite of the legacy Express API built for concurrency, correctness and time-zone safety.
- Live since
- 2023 on iOS & Android
- Processes
- API · Socket · Worker · Cron
- Modules
- 12 domain modules
- Clients
- Flutter app + web admin
The problem
The app grew from a simple quiz into a daily habit product: live quizzes where every player answers the same question in the same second, daily manna, memory verses recited by voice, games, streaks and seasonal leaderboards.
The legacy Express backend had accumulated years of features without clear boundaries. Live quizzes, reward balances and reminders were sensitive to race conditions, retries and server time zones. The goal of v6 was a rewrite that kept every feature and every existing client working while making the hot paths correct under load.
My role
- Led the v6 backend rewrite end to end — inventory of the legacy system, module design, migration plan and implementation.
- Designed a modular monolith that runs as four independently scalable processes from one codebase.
- Built the live-quiz engine and socket gateway for high-concurrency answer handling.
- Rebuilt rewards as a ledger with wallet projections, streaks, periods and leaderboards.
- Wrote data migrations, index tooling and a PII scrubber for working safely with production copies.
- Set up the API contract (OpenAPI export) used by the Flutter and web clients.
What the product does
Live quizzes
Scheduled live sessions with countdowns, instant right/wrong feedback, real-time leaderboards and monthly prizes. Announced quizzes trigger reminders to everyone who signed up.
Daily words
Daily Manna, verse of the day images, daily change cards and configurable reminders — delivered in each user's own time zone.
Memory verse recitation
Users recite a verse aloud; speech-to-text plus fuzzy matching scores the attempt, with retry limits and graceful handling when processing fails.
VersePlay
Verse Scramble, Verse Search and Verse Builder games, Verse Heroes and flash cards — with daily games, reveals paid in wisdom points and per-game stats.
Rewards & achievements
Crowns, kingdom points and wisdom points, streaks per category, achievements with server-owned countdowns, and live plus archived leaderboards.
Growth
Referral links and journeys, share rewards, a WhatsApp welcome flow, device-integrity checks and user exports for the admin team.
Architecture
A modular monolith: one NestJS codebase, twelve domain modules, four entry points. Each process loads only the modules it needs and scales on its own.
API
REST API for the app and admin panel, with OpenAPI docs exported for client code generation.
Socket
WebSocket-only Socket.IO server with a sharded Redis adapter, running the live-quiz gateway and ticker.
Worker
BullMQ consumers for session finalisation, reminders, referrals, WhatsApp, reports and storage cleanup.
Cron
Scheduled jobs with Redis locks and missed-run recovery, all evaluated in an explicit business time zone.
Engineering highlights
- 01
Cheap, correct hot paths
Each live-quiz answer costs one Lua script on Redis and at most one single-document MongoDB write, so the busiest second of a session stays predictable.
- 02
Ledger as source of truth
Reward balances are projections of an append-only ledger. Wallets can be verified and repaired from the ledger, and admin adjustments require an idempotency key.
- 03
Side effects never repeat
Jobs, outbound calls and reward credits are idempotent, so retries after a crash or timeout never double-pay a user or double-send a message.
- 04
Time-zone proof
The test suite runs under several server time zones — UTC, India, Los Angeles and UTC+14 — to prove nothing depends on the host clock.
- 05
Fault tolerance by design
Documented behaviour for each failure: what happens when Redis is down, graceful shutdown, readiness vs. health endpoints, and read-only smoke tests that are safe to run against production.
- 06
Safe production copies
A scrubber removes every name, number, token and credential from a production copy, and a verifier scans every field before the copy can be used.
Tech stack
Backend
Data
Async & Realtime
Integrations
Ops
Clients
What I took away
Inventory before rewrite. Cataloguing every legacy endpoint, model and known problem first turned the rewrite into a checklist instead of a gamble.
Design for the worst second. Live features are judged by their peak, so the hot path was budgeted down to individual Redis and Mongo calls.
Time zones are a correctness bug waiting to happen. Testing under multiple server zones caught issues no code review would.