KBT Ultimate Tech Stack

A sourced, practical technology blueprint for making Know Brainer Trivia the strongest possible live trivia platform: instant gameplay, TV-style live hosting, reliable question production, automated proofing, anti-cheat, venue operations and scale.

The Call

Best practical direction: stay Cloudflare-first for the core platform, use Durable Objects as the authoritative live game engine, use Cloudflare Realtime SFU for host video/camera, use D1/R2 as the operational ledger and asset store, use Queues/Workflows for background jobs, use OpenAI structured generation plus web search/evals for question production, then enforce quality with Playwright and k6.

Keep: Cloudflare Workers/Pages/D1/R2 Build: Durable Object game rooms Add: Realtime SFU presenter feed Add: Analytics Engine dashboards Trial: Ably/LiveKit only if Cloudflare limits appear Avoid: bolting on every SaaS just because it exists

1. Live Game Engine

Decision: one Durable Object per live game room. It owns clock, question state, player presence, answers, eliminations, buy-backs, reconnects and host authority. D1 stores the permanent record after each state transition.

  • Use hibernatable WebSockets so idle connected rooms are cheaper and more resilient.
  • Use server-authoritative time and answer windows. Phones never decide if they are late.
  • Keep polling only as a fallback, not the primary path.

2. Host Video And Show Feed

Decision: move host camera/presenter media onto a proper WebRTC SFU path. Keep external YouTube/Twitch links as optional backup, not the core product.

  • Cloudflare Realtime SFU is the closest fit because it runs on the same global network as the rest of KBT.
  • Cloudflare Stream is better for large passive broadcast, replay, recording and simulcast.
  • Daily or LiveKit are serious fallbacks if we hit feature gaps in Cloudflare Realtime.

3. Question Factory

Decision: keep the current generated proof pack, but upgrade the generator into a pipeline: source, generate, structure, fact-check, asset-check, visual proof, approve, publish.

  • OpenAI Structured Outputs for strict question schemas.
  • OpenAI Web Search for sourced current facts where needed.
  • OpenAI Batch API for large overnight generation and media jobs.
  • OpenAI Evals for regression tests on difficulty, factuality and style.

4. Scale And Reliability

Decision: split fast live work from background work. Players answering a question should not wait for image generation, emails, roster sync, payroll, media cleanup or bulk analytics.

  • Queues for async jobs that must not be lost.
  • Workflows for multi-step production jobs that need retries and persisted progress.
  • R2 for generated media, proof artifacts, audio, images and exports.

5. Anti-Cheat And Trust

Decision: do not rely only on an honesty slide. Add layered protection that is light for real players and harsher when behaviour looks wrong.

  • Turnstile on suspicious signups, QR claims and high-risk actions.
  • Device/session fingerprinting at product level, not creepy ad-tech tracking.
  • Answer timing anomaly detection: impossibly fast streaks, duplicate devices, repeated team switching.
  • Host tools: flag, freeze, reject answer, force team merge, audit timeline.

6. Testing Like A Real Product

Decision: make every feature prove itself automatically before Paddy or a tester has to stare at it manually.

  • Playwright end-to-end tests for host/player/projector flows.
  • Playwright visual screenshots for slide layout and image sizing.
  • k6 WebSocket load tests for thousands of connected players.
  • Analytics Engine metrics for live p95/p99 latency, answer arrival, reconnects and error spikes.

Technology Decisions

AreaBest KBT choiceWhyFallback / alternative
Realtime game stateCloudflare Durable Objects + hibernatable WebSocketsAuthoritative per-game state, strong coordination, cheap idle sockets, already matches the KBT edge stack.Ably Pub/Sub if we need a managed cross-cloud realtime bus.
Host camera/videoCloudflare Realtime SFUWebRTC/SFU media on Cloudflare's network, suitable for low-latency presenter feed.LiveKit or Daily for richer video SDKs if Cloudflare Realtime gaps block us.
Broadcast/replayCloudflare StreamServerless live/on-demand video, recording, playback and simulcast.Mux if product needs media workflows Cloudflare Stream cannot cover.
Operational dataD1 for relational data; DO SQLite for per-game stateD1 is the shared ledger; DO storage is the room-local source during live play.Postgres only if D1 limits become real business limits.
AssetsR2Generated images, audio, proof packs and exports need object storage without painful egress economics.Keep external media CDNs only for third-party assets.
GenerationOpenAI Responses + Structured Outputs + Web Search + BatchStrict schemas, sourced current facts and bulk generation fit KBT's question factory.Use specialist tools only for media types OpenAI does not handle well enough.
Quality gatesOpenAI Evals + Playwright visual QAContent quality and slide quality both need automated regression gates.Manual-only review is too slow for mass production.
Load testingk6 WebSocket + browser testsLive trivia fails at connection spikes, not just page load.Cloud load testing later for very large national events.
SecurityTurnstile + Cloudflare WAF/API protection + host audit controlsProtect signups and high-risk actions without making normal pub users miserable.Passkeys for admin/hosts later.
ObservabilityWorkers Analytics Engine + dashboards + structured logsWe need live evidence: latency, reconnects, failures, rooms, venues, players and question performance.Sentry for frontend exception visibility if needed.

Build Order

  1. Realtime gold standard: lock Live and Signature onto DO-backed room state everywhere; no mixed polling-first paths.
  2. Presenter feed v2: Cloudflare Realtime SFU host camera, device picker, preflight test, fallback Stream/external URL.
  3. Mass production question pipeline: generation queue, strict schema, web-sourced facts, difficulty curve, eval grading, visual QA, approve/publish.
  4. Scale proof: k6 1k, 5k, 10k simulated player runs; record p95 host-to-player latency, answer acceptance latency and reconnect recovery.
  5. Ops cockpit: one dashboard for live rooms, venue status, question production, payroll bridge, failures, deployments and tester links.
  6. Security/passkeys: protected admin and host actions behind stronger identity, with Turnstile on suspicious public flows.