Menu

Two Buyers, One Seat: Shipping a Reliable Python Ticketing Backend with FastAPI, PostgreSQL and Celery
📰

Two Buyers, One Seat: Shipping a Reliable Python Ticketing Backend with FastAPI, PostgreSQL and Celery

DEV Community: postgres·Sachin Shah·12 days ago
#m38KkwtT
#devtopostgresql#devto#dev#seat#order
Long article (2664 words) — no AI summary yet.
Reading 0:00
15s threshold

The problem: everyone clicks at the same moment

Selling tickets looks like basic CRUD. A user picks seats, pays, gets a ticket. Insert a row, send an email, done.

Then a popular event goes on sale. Hundreds of people hit "Buy" within the same few seconds, and a lot of them want the same front rows. Now the boring CRUD app has to answer a hard question over and over: who actually got that seat?

At work I spent a good stretch on the backend of a SaaS ticketing platform built with FastAPI, PostgreSQL, Celery, Redis, Docker and Pytest. This post covers the parts that decided whether it was reliable: holding seats safely under concurrent requests, tuning PostgreSQL before reaching for a cache, moving slow work into background jobs that are safe to run twice, and the tests that let me change all of it without fear.

The flow, end to end

The short version: FastAPI validates the request and works out the price. PostgreSQL decides who gets the seat, inside one transaction.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.