Requirements


Functional Requirements:


  • Allow reservation of a parking spot.
  • Process payment for the reservation.
  • Enable parking of a car in the reserved spot.
  • Support early departure before reservation time expires.
  • Gate check-in/out.
  • Handle no show.



Non-Functional Requirements:


  • Strong consistency
  • High availability
  • Scalability


API Design

  1. GET /api/parking/spots/capacity: This endpoint checks the current capacity of the parking lot and provides a price quote for available spots. It helps users understand their options before proceeding with a reservation.
  2. POST /api/parking/reserve: This endpoint allows users to hold or reserve a parking spot tentatively. It should accept parameters like user ID, vehicle details, and desired time window. This is crucial for managing spot availability and preventing double bookings.
  3. POST /api/parking/reserve/complete: After payment is processed, this endpoint finalizes the reservation. It ensures that the spot is officially booked and updates the system accordingly.
  4. POST /api/parking/checkin: This endpoint registers the arrival of a vehicle, marking the spot as occupied. It’s essential for managing real-time occupancy and ensuring smooth gate operations.
  5. POST /api/parking/checkout: This endpoint handles the vehicle's departure, freeing up the spot for future reservations.
  6. POST /api/parking/no-show: This endpoint manages no-show scenarios, allowing the system to release reserved spots after a certain time if the user does not check in.



High-Level Design

Describe the overall system architecture. Identify the main components needed to solve the problem end-to-end. Use the diagramming tool to create a block diagram.





Detailed Component Design

Deep dive into 2-3 key components. Explain how they work, how they scale, discuss tradeoffs, capacity, and any relevant algorithms or data structures.