A backpressure-safe FastAPI ingestion API built to swallow ~50,000 events/sec without ever doing one INSERT per event or growing an unbounded buffer.
Nobody has started this yet — be first.
No published tickets in this project yet.
About this project
A production-shaped async event ingestion service whose one hard rule is: never one per incoming event. Accepted events go onto a bounded in-process (never an unbounded list); a pool of flush workers drains it in batches, flushing whichever comes first, events collected or elapsed; each batch is written with one statement, making idempotency atomic and race-free without a -then-; and when the queue is full, new requests get a fast , not a growing buffer — that's the entire backpressure story. A real, measured load test () drives the service to tens of thousands of events/sec and cross-checks against Postgres row counts for a genuine zero-data-loss proof, and carries the constraint the whole dedupe design leans on.
Clone it
$git clone https://github.com/nishant1821/FastAPIDevTraining.gitHow to run it locally, step by step.
INSERTasyncio.Queuebatch_max_sizebatch_max_wait_secondsINSERT ... SELECT * FROM unnest(...) ON CONFLICT (event_key) DO NOTHINGSELECTINSERT503load_test/async_load_test.pyGET /events/statssql/schema.sqlUNIQUE (event_key)Twenty tickets, ordered easy → hard: twelve are bugs deliberately injected into an otherwise-working codebase (an inverted any()/all() readiness check, a swapped pair of positional arguments that silently corrupts every row's device_id/event_type columns, a boolean guard using or where and was meant, a naive-vs-aware datetime mismatch that only breaks outside UTC); eight are enhancements with a stub already wired into the app (a panicking-equivalent no-op) so the codebase and its tests build before the real implementation is written. Every ticket has a dedicated pytest file that goes green when the fix is correct, and the practice_tickets README documents exactly which of the project's own pre-existing tests/ it collaterally turns from red to green along the way.