System requirements


Functional:

Cars need to be able to enter the parking lot

cars need to be able to exit the parking lot

pay for parking X amount of time


Non-Functional:

when one parking lot is full, cars need to be directed to a different lot




Capacity estimation

100 cars per lot, scales infinitely



API design

park car

pay for parking

exit lot



Database design

parked car:

car #

lot #

time parked

parking time allocated


parking lot:

lot #

# of available spots

# of spots utilized




High-level design

database

APIs (park, exit, etc)

load balancer - balance which lot cars park






Request flows

car requests parking

car assigned lot

car parks for X hours (as defined by payment)

car leavs lot




Detailed component design

database = noSQL, this scales horizontally. One database per parking lot allows for easy scaling

Load balancer = check closest available parking lot, if full send to next available parking lot




Trade offs/Tech choices

database: could definitely be a SQL database for easy querying of who is parked and where. I like noSQL as reads don't need to happen that often and scaling is easy. We don't need to save records of cars that have previously been parked




Failure scenarios/bottlenecks

Queue for parking/exiting is the main bottleneck

You never want users to have to search for their own place to park. Parking should always be assigned



Future improvements

Account for different types of cars (EVs etc)

overnight parking and specified lots for longer parking

Reserved parking or reserved spots