Design a Sports Betting Platform
Understanding the Problem
🎲 What is a sports betting platform? A sportsbook like DraftKings Sportsbook, FanDuel or Bet365 offers markets on sporting events (who wins, total goals, next scorer) with a price, the odds, on each outcome. Users place bets at those odds, the platform holds their stake, and when the result is known, winners are paid. In-play betting keeps markets open during the match, with prices moving every few seconds.
Prediction markets like Polymarket or Kalshi look similar from the outside, since you're still betting on an outcome, but the model is different. A sportsbook is the counterparty to every bet and sets the price. A prediction market is an exchange: users trade outcome shares with each other through an order book, and the platform only matches them and holds collateral. We'll design the sportsbook as the main flow, since it's what most interviewers mean, and cover the exchange model as a deep dive, because the interesting comparison is exactly where the two differ.
Functional Requirements
Agree on scope with your interviewer. Betting platforms are wrapped in regulation (KYC, geolocation, responsible gambling), which matters in real life but is mostly a separate system.
Core Requirements
- Users should be able to browse events and markets, and see odds update in real time, both before and during matches.
- Users should be able to place a bet (a single, or a parlay of several selections) at the odds shown, with the stake taken from their wallet.
- Bets should be settled when results are known: winners paid, losers closed, void bets refunded.
- (Exchange variant) Users should be able to trade outcome shares with each other in a prediction market.
Below the line (out of scope)
- KYC, deposits and withdrawals. We'll assume a wallet with a ledger.
- The pricing models that set the odds. We'll treat the trading team's pricing engine and third-party odds feeds as inputs.
- Promotions, bonus bets and loyalty programs.
- Responsible-gambling limits (required in regulated markets; they plug in as extra checks at bet placement).
Non-Functional Requirements
Ask what the biggest day looks like. For our design, the Super Bowl: 10 million users active during the game, with a peak of around 30,000 bets per second in the minutes before kick-off and short bursts of similar size during the game. Across all sports, about 50,000 markets are live at peak.
Core Requirements
- A bet must only be accepted at a price the platform is still offering, or at a price the user explicitly agreed to accept. Bets placed after an event that changes the outcome (a goal, a touchdown) must not be accepted at the old price.
- Money must be exact: a stake is debited exactly once, a winning bet is paid exactly once, and an accepted bet is never lost.
- Bet placement should return a result in under a second pre-match. In-play acceptance can take a few seconds by design.
- Odds updates should reach users within about a second.
- The platform's risk (how much it loses if one outcome happens) must stay within limits set by traders, even on the hottest market.
- Everything must be auditable: regulators can ask why any bet was accepted, at what price, and when.
Below the line (out of scope)
- Active-active multi-region. Regulated betting is usually tied to a jurisdiction and its data center anyway.
- Sub-millisecond latency. This isn't high-frequency trading.
The numbers aren't extreme. 30,000 bets per second is meaningful but well within what a sharded database can write. Odds updates are heavier: 50,000 live markets, each repricing every few seconds, is on the order of 10,000-25,000 price changes per second to fan out to users who are watching them.
What makes this hard is correctness under change. Prices move constantly, a goal can make every price on a match wrong in an instant, and users are racing to bet at the stale price. And unlike a store selling a fixed stock, the constraint isn't "units left" but exposure: how much the book loses if a particular outcome happens.
The key insight: there are two kinds of limits here, and they need different treatment. A user's wallet balance is a hard limit that must be exact, but it's per user, so it has almost no contention. A market's exposure limit is a soft risk control that's shared by everyone betting on the favorite, so it's highly contended, but overshooting it by a small amount is acceptable. Design each for what it is.