Requirements
Functional Requirements:
- Allow reservation of a parking spot.
- Process payment for the reservation.
- payment model (monthly, daily, yearly) or support cash or mobile pay.
- Enable parking of a car in the reserved spot.
- Support early departure before reservation time expires.
- Gate check-in/out.(type of checking license or tickets or mobile app )
- Handle no show.
- real-time availability display
- vehicles supported
- shows strict if it is reserved for whole day
Non-Functional Requirements:
- slow latency
- high performance
- fault tolerance
- race condition/concurrency ( keep in mind that multiple cars might reserve at the same time)
- scalability
API Design
# 1. Check availability (Real-time)
GET /api/v1/lots/{lotId}/availability?vehicleType=CAR&start=2026-04-01T10:00:00Z&end=2026-04-01T14:00:00Z
Response: {
"availableSpots": 12,
"spots": [{"id": "A-101", "type": "COMPACT", "price": 15.00}],
"dynamicPricing": {"surgeMultiplier": 1.2}
}
# 2. Hold spot (Pre-reservation lock)
POST /api/v1/reservations/hold
Body: {"lotId": "lot-123", "spotId": "A-101", "start": "...", "end": "..."}
Response: {
"holdId": "hold-uuid-789",
"expiresAt": "2026-04-01T09:15:00Z", # 15 min to pay
"paymentIntent": "pi_123456"
}
# 3. Confirm reservation (After payment)
POST /api/v1/reservations/confirm
Body: {"holdId": "hold-uuid-789", "paymentMethod": "card_123"}
Response: {
"reservationId": "res-456",
"qrCode": "base64encoded",
"licensePlate": "ABC-123"
}
# Gate checks if vehicle can enter
POST /api/v1/gate/validate
Body: {
"gateId": "gate-south-1",
"licensePlate": "ABC-123", # OR "qrCode": "..."
"timestamp": "2026-04-01T09:58:00Z"
}
Response: {
"allowed": true,
"reservationId": "res-456",
"spotId": "A-101",
"action": "OPEN_GATE"
}
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.