We will require 4 REST API:
GET /reserve get all reservation.
GET /reserve/
POST /reserve to reserve a parking spot in advance.
UPDATE /reserve/
DELETE /reserve/
POST /check-in check if spot is reserved or assign new
POST /check-out free the spot
We can build 2 microservice one for reserving and unreserving and other to handle check in and check out and scale them independently depending on workload. Both will write to the same database. Reserve service allows booking a spot for a specific duration. Checkin service handles all customers at the parking entrance and either reserved spot is assigned or nearest. if parking duration is more far spot will be assigned if short duration closer spot.
Deep dive into 2-3 key components. Explain how they work, how they scale, discuss tradeoffs, capacity, and any relevant algorithms or data structures.