Delivered remotely for a business based in Amsterdam, Netherlands. Names withheld by agreement.
Project Overview
Live entertainment creates a narrow window for audience interaction. Viewers watching a match, awards broadcast, or esports series decide within seconds whether to engage before the moment passes. Traditional companion apps often fail during these bursts because sluggish REST waterfalls, drifting countdown timers, and delayed score recalculations break immersion just as the broadcast peaks.
This project delivered a cross-platform prediction and rewards application built with React Native and Redux on the client, paired with a Node.js, Express, and GraphQL backend anchored by PostgreSQL. Players browse upcoming live events, lock in multi-question predictions before strict cutoff timestamps, track live standings against peers, and exchange earned points for digital or physical rewards without leaving the viewing flow.
Business Bottleneck
Audience prediction platforms break down under real-world live-event conditions when engineered like standard content feeds:
- Clock drift and late-pick exploits: Relying on device clocks or loose client countdowns lets players submit answers after a live broadcast event has already occurred on a faster stream.
- Pre-kickoff traffic spikes: Fan engagement clusters in the final minutes before an event locks, saturating uncached SQL read queries and causing timeout cascades right at tip-off.
- State fragmentation across mobile screens: Duplicated fixture and pick objects across navigation stacks lead to contradictory UI states where a slip appears submitted on one screen and open on another.
- Ledger drift under concurrent scoring: Updating mutable user score integers without transactional locking introduces race conditions whenever multiple questions settle or a player redeems points simultaneously.
Architectural Strategy
We anchored the design on two boundaries: server-authoritative event timing and normalized unidirectional client state. Instead of trusting mobile timers or firing parallel REST requests per card, the React Native app fetches a deterministic server clock offset at session start and pulls structured event graphs through GraphQL.
On the server, Node.js and Express host a modular GraphQL layer that separates high-concurrency read paths from strict transactional write paths. Active fixture definitions and countdown metadata serve cleanly through Redis, while pick submissions, market settlements, and reward redemptions execute inside ACID PostgreSQL transactions backed by an append-only points ledger.
Core Capabilities
- Synchronized Prediction Slips: Players review upcoming and in-play question cards with server-calibrated lock countdowns, clear entry rules, and instant pick confirmation.
- Multi-Format Question Markets: Supports binary outcomes, score brackets, MVP picks, and sequential round prompts configured dynamically per event without shipping mobile app updates.
- Live Leaderboards & Rank Tracking: Displays global, event-specific, and friend-group rankings updated as moderators finalize individual event segments.
- Auditable Points Ledger & Rewards Store: Tracks every earned bonus, streak multiplier, and prize claim as immutable ledger entries with inventory checks during redemption.
- Moderator Settlement Console: Provides event operators with lock-override controls, two-person outcome verification, and void-and-recompute workflows for corrected rulings.
Technical Architecture
The React Native application runs a Redux Toolkit store populated by typed GraphQL queries and mutations. Express handles transport security, JWT verification, and rate-limiting middleware before passing requests to the GraphQL execution engine. Resolvers coordinate between Redis caches for hot read models and PostgreSQL for durable transactional state.
Flow: React Native App (Redux Store) → GraphQL over HTTPS / WebSockets → Node.js & Express Gateway → Redis (Lock Windows & Leaderboards) + PostgreSQL (Picks, Outcomes & Points Ledger)
When a moderator locks or settles a question, an Express-hosted worker transitions the market state in PostgreSQL, evaluates matching picks in bounded batches, appends credit rows to the points ledger, and refreshes the corresponding Redis sorted sets. Connected mobile clients receive lightweight invalidation signals or delta updates, patching normalized Redux slices without discarding local scroll position or pending slips.
Technology Stack
| Category | Technology detail |
|---|---|
| Mobile Client | React Native (shared iOS and Android codebase) |
| Client State Layer | Redux Toolkit with normalized entity slices and optimistic pick queues |
| API Protocol | GraphQL schema with typed queries, mutations, and persisted operations |
| Application Server | Node.js runtime with Express HTTP pipeline and GraphQL middleware |
| Primary Database | PostgreSQL with row-level locking and serializable ledger transactions |
| Hot-Path Caching | Redis for active event lock state, rate limits, and leaderboard caching |
| Real-Time Updates | WebSocket-backed GraphQL subscriptions and adaptive delta polling |
| Push & Deep Links | Native push notifications routed directly to active match cards |
| Admin & Moderation | Authenticated GraphQL admin mutations for market closure and settlement |
Engineering Trade-offs & Solutions
| Engineering Challenge | Solution & Trade-off |
|---|---|
| Over-fetching nested fixtures and user picks across mobile viewports | Adopted GraphQL with persisted query whitelisting; added schema discipline and query-complexity limits in exchange for single-round-trip screen hydration. |
| Broadcast latency differences creating unfair late picks | Enforced strict server-side lock deadlines cached in Redis and re-checked in PostgreSQL transactions, pairing clear countdown buffers on mobile. |
| Concurrent question settlements risking duplicate point credits | Implemented idempotent settlement keys (question_id + user_id) in PostgreSQL unique constraints, ensuring retries never double-credit user wallets. |
| Stale leaderboard views during rapid scoring bursts | Replaced expensive live SQL rank aggregations with Redis sorted sets rebuilt incrementally per settlement batch, trading sub-second eventual consistency for flat database CPU. |
Security & Reliability
Prediction and rewards platforms attract automated scripting and timing abuse. Express enforces per-IP and per-account sliding-window rate limits backed by Redis, while GraphQL depth and cost analyzers reject abusive nested queries before resolvers execute.
Every pick mutation validates JWT claims, active account status, and market lock state inside PostgreSQL. Reward redemptions require fresh session verification and acquire row-level locks on both the user's wallet summary and the reward SKU inventory row, preventing negative balances or oversold prizes. Structured correlation IDs trace every request from the React Native client through Node.js resolvers down to SQL transaction logs.
Performance & Scale
To keep React Native responsive on mid-range Android and iOS devices during live matches, Redux slices store flattened entities via createEntityAdapter, avoiding deep object cloning on every tick. Countdown timers derive remaining time from a single monotonic clock delta rather than dispatching 60-times-per-second Redux actions.
On the backend, PostgreSQL uses partial indexes on active open markets and unsettled picks so settlement jobs scan only pending rows rather than historical archives. Connection pooling via PgBouncer caps database connections cleanly across horizontal Node.js worker instances, allowing API pods to scale out ahead of marquee broadcasts without exhausting PostgreSQL slots.
Operational Outcomes
Consolidating live prediction workflows onto a single React Native and GraphQL architecture gave product and event operations predictable control over live game nights:
- Consistent cross-platform releases: Shared Redux state logic and GraphQL schema types kept iOS and Android behavior aligned without maintaining two diverging native networking layers.
- Dependable cutoff enforcement: Server-verified lock timestamps eliminated disputes over borderline submissions when live broadcasts shifted rapidly.
- Clean financial and reward traceability: Append-only PostgreSQL ledger records made player support investigations and prize inventory reconciliation straightforward.
- Resilient event-night scaling: Separating Redis-backed leaderboard reads from transactional PostgreSQL writes kept response behavior steady through pre-event submission surges.