Design Eventbrite (event ticketing)
Sell a limited number of tickets without ever overselling, survive on-sales where demand is ten times the supply, and let thousands of people through the door in minutes. The core: inventory as the single source of truth, holds with expiry, a waiting room and verifiable tickets.
In one sentence
Treat ticket inventory as a strongly consistent counter (atomic updates, holds with TTL), put a waiting room in front of hot on-sales, and issue signed QR tickets that can be checked at the door.
A reference design: it covers what an app like this needs and follows how these companies have described their systems publicly, simplified to be learnable.
Requirements
Functional
- Organizers create events with ticket types and capacity
- Buyers find events, hold tickets and pay
- Tickets delivered by email and wallet
- Check-in at the door
Non-functional
- Never sell more tickets than exist
- Survive spikes of 10–100× normal traffic at on-sale time
- Event pages: very read-heavy
- Check-in fast and resilient to bad connectivity
Back-of-the-envelope estimates
| Metric | Estimate |
|---|---|
| Normal traffic | ~1M tickets / day ≈ 12 orders/s: tiny |
| Event page views | ~100 views per ticket sold → 1,200 reads/s |
| Big on-sale | 200K buyers in the first minute for 20K tickets ≈ 3,300 attempts/s on one event |
| Check-in | 40K people through the doors in 1 hour ≈ 11 scans/s per venue |
Average load is small; the design is driven by the spike on a single event, which concentrates all the writes on one inventory counter.
API and data model
GET /events/:id → event page (cached)
POST /events/:id/holds { ticketTypeId, qty } → { holdId, expiresAt }
POST /orders { holdId, payment } → { orderId, tickets }
POST /checkins { ticketId, signature } → admitted | already_used
ticket_types(id, event_id, name, price, capacity, remaining)
holds(id, ticket_type_id, qty, expires_at)
orders(id, buyer_id, event_id, total, status, idempotency_key)
tickets(id, order_id, code, used_at)Architecture
Step by step · Buy tickets
- 01Picks 2 general admission tickets
- 02POST /events/7/holds { qty: 2 }
- 03Creates a 10-minute hold
- 04Hold stored with TTL; count decremented atomically
- 05UPDATE … SET remaining = remaining - 2 WHERE remaining >= 2
- 06Buyer pays within the hold
- 07Charge with an idempotency key
- 08"Order paid" job
- 09Two signed QR tickets generated
- 10Tickets in the inbox and wallet
At this scale · 1M users
Built for on-sale spikes
- ▸A waiting room lets buyers in at the rate inventory can sell
- ▸Inventory service owns holds and counts; checkout owns payments
- ▸Check-in service validates signed QR codes at the door, even offline
Tap any box to see what it does.
Deep dive: never oversell
Two buyers reading "1 left" at the same time and both buying is the classic race condition. Options, from simplest to most scalable:
| Technique | How | Notes |
|---|---|---|
| Conditional update | UPDATE … SET remaining = remaining - 2 WHERE id = ? AND remaining >= 2 | Atomic in one statement: if 0 rows changed, it's sold out |
| Row lock | SELECT … FOR UPDATE then update | Correct, but buyers queue on the lock during spikes |
| Holds with TTL | Reserve for 10 min; expired holds return to stock | Lets people pay without losing the tickets, keeps stock honest |
| Atomic counter in Redis | DECRBY and give back if it goes negative | Absorbs the spike in memory; the DB stores the final orders |
| Single writer per event | All requests for one event go to one partition / actor | Serializes writes on the hot event without global locks |
How it changes with scale
Step by step · Hot on-sale
- 01200K fans at 10:00 for 20K tickets
- 02Everyone hits the database at once: locks, timeouts
- 03"You have 10 minutes to complete your purchase"
At this scale · 100 users
A transaction protects the inventory
- ▸Events, ticket types and orders in PostgreSQL
- ▸Buying is an atomic UPDATE … WHERE remaining >= qty: no overselling
- ▸Tickets emailed by the same app
Tap any box to see what it does.
| Users | What you run | Why it changes |
|---|---|---|
| 100 | Monolith + PostgreSQL with conditional updates | Correctness is all you need |
| 10K | CDN + Redis holds, background jobs for tickets | Pages and holds shouldn't hit the DB every time |
| 1M | Waiting room, inventory and checkout services, check-in service | On-sales concentrate traffic on single events |
| 100M+ | Sharded by event, edge queue, bot protection | Global fans and resellers competing for the same seats |
Key takeaways
- 01Inventory must be strongly consistent: atomic conditional updates or a single writer per event.
- 02Holds with a TTL let buyers pay without blocking stock forever.
- 03A waiting room turns an on-sale stampede into a steady flow.
- 04Signed QR tickets can be validated at the door, even with poor connectivity.
Check your understanding
1 of 3
In a ticketing system like Eventbrite, how do you never oversell tickets?