Loading...
Functional Requirements:
Non-Functional Requirements:
We will use RESTful principles for client-facing operations.
POST /v1/reservationsuser_id, lot_id, vehicle_type, start_time, end_timereservation_id, spot_id, statusPUT /v1/reservations/{reservation_id}/cancelstatus, refund_amountPOST /v1/gates/check-inlot_id, gate_id, identifier (license plate string or QR token)action (open_barrier, deny), spot_idPOST /v1/gates/check-outlot_id, gate_id, identifieraction (open_barrier), pending_chargesPOST /v1/paymentsreservation_id, amount, payment_method_idtransaction_id, statusThe architecture is broken down into modular, independent services to isolate failures and scale components independently.
SELECT ... FOR UPDATE query to lock the specific row of an available parking spot.RESERVED for the specified time block, and the transaction commits. If the row was already locked by another thread, the system catches the failure and retries fetching a different available spot.available_spots_by_type. If the Redis counter is zero, we reject the request immediately without hitting the database.Plate_XYZ: {reservation_id, spot_id, valid_time}.VehicleEnteredEvent.OCCUPIED.VehicleEnteredEvent is not received before the TTL expires, a worker function executes, changes the reservation status to NO_SHOW, applies the penalty fee via the Payment Service, and releases the spot back into the available pool.VehicleExitedEvent is received before the end_time, the system immediately recalculates the cost, triggers a refund via the Payment Service if applicable, and unlocks the spot for new reservations instantly.