Requirements

Functional Requirements

  • The user arrives at the entrance gate.
  • The user can choose:
    • time slot
    • parking spot type (standard, VIP, disabled, electric)
    • vehicle size/type (motorcycle, car, 9-seater van, van, truck)
  • The ticket automatically prints the assigned parking spot number.
  • Payment can be made by credit card or cash.
  • Vehicle recognition through license plate detection.
  • Automatic barrier/gate opening.
  • Reservation validation.
  • The system guides the user to the assigned parking spot.
  • Sensors detect actual parking spot occupancy.
  • Real-time parking availability updates.
  • Total parking fee calculation.
  • Automatic gate opening after payment.
  • Surveillance cameras for monitoring and security.
  • Alarm system support.

Non-Functional Requirements

  • The system must support thousands of users and traffic spikes.
  • The parking lot must continue functioning even in case of server failures or network issues.
  • The barrier must open within a maximum of 3 seconds and close within the same time after the vehicle passes.
  • It is essential to prevent double assignment of parking spots.
  • The system must be easily maintainable and upgradable.


API Design

Define the APIs expected from the system. This is your chance to analyze and define the read and write paths so that you can come up with the high-level design...




High-Level Design

The parking system is composed of a few main parts that work together.

1. User Interface

  • Entry kiosk (ticket issuance)
  • Payment (credit card or cash)

2. Physical System (Hardware)

  • License plate recognition camera
  • Automatic barrier gate
  • Parking spot sensors
  • Surveillance cameras

3. Central System (Backend)

A single system (or a few services) that manages everything:

  • assigns parking spots
  • checks availability
  • validates tickets
  • calculates payment
  • opens the barrier gate

4. Database

  • stores users
  • stores reservations
  • stores parking spots
  • stores payments



Detailed Component Design

1. Parking Assignment

  • Assigns a free parking spot compatible with the vehicle
  • Uses a list of free/occupied spots
  • Must lock the spot to avoid double assignments
  • Scales using cache and updates from sensors

2. Payment Service

  • Calculates cost based on parking duration
  • Handles payments via credit card or cash
  • Stateless and easy to scale
  • Must prevent duplicate payments (idempotency)

3. Sensor System

  • Sensors detect whether a parking spot is occupied
  • Sends real-time updates to the backend
  • Keeps parking availability state updated
  • Uses events for scalability