Estimate the scale of the system. Consider daily active users, read/write ratio, storage requirements, bandwidth, and any relevant QPS calculations...
Following endpoints
We have an api service that accepts updates for our database tables and is able to receive webhooks from the check in / out detection system. The api also exposes all parking spots available within a certain timeframe.
We have a front end or mobile app where users can view and book spots.
We already have an external detection system to track the check in and out times of certain license plates.
A relational database like MySQL or Postgres’s.
A table with all spots with a status MAINTENANCE / AVAILABLE.
A table with named bookedSlots with a reference to the spot, the registered license plate and a time slot per half hour. A booking of 2hours would get 4 entries. It has a unique key on the spotId and the slot. This ensures no slots are booked twice in the database. The record also holds a status key with RESERVED, BOOKED and FULLFILLED . Reserved is for when a user has reserved but is still in checkout.
Table with check in and check out times.
Deep dive into 2-3 key components. Explain how they work, how they scale, discuss tradeoffs, capacity, and any relevant algorithms or data structures.