Skip to content
All work

Coasted

Backend and web portal for a gamified maths and logic learning app with live multiplayer.

role
Backend and Web Lead
for
Coasted Code (contract)
period
May 2026 - Present
status
Live
Three Coasted app screens - leaderboard, home with games, and the Number Ninja game
277 / 348
commits authored
35
data models
3
payment providers

Overview

Coasted teaches maths and logic to students through games: Number Ninja, Codi logic puzzles, quizzes and speed challenges, played solo or head to head. The founder built the Flutter app; I built everything it talks to, from live multiplayer and leaderboards to subscriptions and the web portal where families and schools manage their accounts.

How it is built

WebSocketsigned webhooksFlutter appbuilt by the founderNext.js 15 portalaccounts, billing, adminNode.js APIREST + live matchesRedisleaderboards, presencePostgreSQLPrisma, 35 modelsPaymentsPaystack, StoreKit, RevCat
Simplified architecture. Arrows show the main request and data flow.

What I built

  • Built the Node.js and TypeScript backend, including WebSocket matchmaking for real-time 1v1 games and fixes for race conditions and challenge desync.
  • Built global leaderboards and online-player presence on Redis sorted sets.
  • Implemented payments across Paystack, Apple StoreKit 2 and RevenueCat with HMAC-verified, idempotent webhooks, a reconciliation sweep, subscriptions, trials, a freemium tier and institution licensing.
  • Built the Next.js 15 web portal for accounts and billing, plus admin tools for analytics, questions, plans and quiz rankings.

Architecture

  • Express and raw WebSockets over PostgreSQL (Prisma, 35 models) and Redis, with Firebase Authentication shared with the mobile app.
  • Request-scoped structured logging (pino with AsyncLocalStorage), Sentry error tracking and Prometheus metrics.
  • GitHub Actions typechecks and lints, then deploys over SSH to a VPS, runs migrations and does a rolling PM2 cluster reload behind Nginx.

Key decisions

Idempotent payment webhooks

Every provider event is verified and de-duplicated before it settles, and a reconciliation sweep catches anything missed, so a retried webhook can never grant or charge twice.

Redis for anything live

Leaderboards and presence change on every game, so they live in Redis sorted sets and sets instead of hitting PostgreSQL on each update.

Challenges

Two players in a live duel could see different question states when messages crossed in flight.

Traced the desync to race conditions in the multiplayer match flow and fixed them on the server.

Subscriptions can be bought on iOS, on Android or on the web.

Normalised all three providers into one entitlement model, so premium unlocks on every device regardless of where it was purchased.

Results

  • Live, with the account portal at portal.coastedcode.com.
  • 42 test files, 32 passing integration scenarios and k6 load tests behind the backend.

Screens

  • Home screen with daily streak and four games

    Home screen with daily streak and four games

  • Number Ninja mode selection with solo and multiplayer duel

    Number Ninja mode selection with solo and multiplayer duel

  • Number Ninja gameplay with timer

    Number Ninja gameplay with timer

  • Global leaderboard podium and rankings

    Global leaderboard podium and rankings

  • Codi logic puzzle sections

    Codi logic puzzle sections

  • Codi level with block-based programming

    Codi level with block-based programming

  • Maths Challenge mode selection

    Maths Challenge mode selection

  • Maths Challenge question with answer options

    Maths Challenge question with answer options

Coasted Code account portal sign-in page
Coasted Code account portal sign-in page

Stack

Node.js, TypeScript, Express, WebSockets, Redis, Prisma, PostgreSQL, Firebase Auth, Paystack, Apple StoreKit 2, RevenueCat, Next.js 15