Onsale
A ticket onsale engine for when thousands of people want the same seats
A virtual waiting room, all-or-nothing seat holds and idempotent checkout, rebuilt in the open from the problems I worked on in production ticketing.
- Redis + Lua waiting room admits buyers in arrival order at a fixed rate, so the seat map and payments only see as many shoppers as they can serve.
- Picking four seats holds all four or none in one atomic step; holds expire on their own.
- Checkout is idempotent: a double-click or dropped connection replays the first result instead of charging twice. A Postgres constraint makes selling a seat twice impossible.
- 696/696
- seats sold in ~20 s to 2,000 simulated buyers
- 0
- seats sold twice, audited in Postgres after every run
- 0
- unexpected errors in 24,251 requests
TypeScript, Fastify, Redis + Lua, PostgreSQL, React, k6, Prometheus, Grafana











