Dev Logs / SkyFlow

SkyFlow

An event-driven catering broker for a day of 300 or more flights. It does not cook meals. It keeps the inventory numbers the kitchen works from.

The operational problem

A kitchen serving that many departures cannot wait for a nightly batch to learn that a flight is two hours late or that forty more passengers just connected. SkyFlow accepts the disruption immediately, recalculates meal demand in the background, and commits the flight, the passenger manifest, every meal row, and an audit record in one database transaction.

Technical highlights

  • FastAPI on a single Uvicorn worker, Pydantic v2 validation, SQLAlchemy 2.0 async with SQLite (WAL, foreign keys on)
  • POST /api/v1/events/disruption returns 202 Accepted before meal math finishes
  • One asyncio lock per flight so concurrent events cannot overwrite each other
  • One meal per boarded person, split across Standard, Halal, Vegetarian, Vegan, and Special Dietary. A cumulative delay of 60 minutes adds a 5% buffer. Cancellation zeroes demand
  • Kitchen queue ranked by closest departure: CRITICAL inside 60 minutes, HIGH inside 3 hours
  • pytest and an httpx ASGI client, one SQLite file per test, including a forced rollback

Business impact

A 90-minute delay on 100 people moves the requirement from 100 meals to 105, and the kitchen queue reorders itself on the next read. Failed recalculations roll back and leave a RECALC_FAILED audit row. Seed data loads 300 flights, and an optional simulator posts a delay or a passenger surge every 15–30 seconds.

The figures are synthetic. The full write-up covers the architecture diagram, every route, and how the design behaves at hub volume.