System requirements


Functional:

  1. Users should be able to search through different garages for availaibility
  2. Users should be able to book slots for given days/times
  3. Different vehicle types: Compact, regular, big, motorcycle
  4. Should ideally use the car type as mentioned and map to correct parking, but can park in larger space as well if we have high availaibility
  5. Determine a rate, and integrate with a 3rd part solution to handle payments



Non-Functional:

  1. Not overbook (Can assume 10% max overbooking)
  2. Scalability
  3. Consistency > Availaibility



Capacity estimation

Estimate the scale of the system you are going to design...

1 garage has 10 floors, 100 parking per floor

Total 1000 parking per garage

10,000 Garages worldwide

total parking 10 Million


10 M users daily park once




API design

Define what APIs are expected from the system...

External APIs


GET /garage/loc={}lat&long -> returns closest garages

GET /garage/:garageId -> [parking space availaible per vehicle type]

POST /garage/:garageID/vehicleType&time={start&end} -> reservationId

POST /reservation/book/:reservationId -> Book

PUT /reservation/book/:reservationId/extendTime -> Rebook to extend






Database design

Garage Table

garageId PK

location

floors

spaces compact

spaces regular

..



Rate Table

garageId, vehicle Type, day, time -PK

rate per hour


booking table

reservationID PK

userId

date

time

vehicleType


spotTypeInventory

garageId

spotType

date

totalInventory

TotalReserved



spot

garageId

spotTypeId

floor



user table

userId

address

location

payment






High-level design

You should identify enough components that are needed to solve the actual problem from end to end. Also remember to draw a block diagram using the diagramming tool to augment your design. If you are unfamiliar with the tool, you can simply describe your design to the chat bot and ask it to generate a starter diagram for you to modify...







Request flows

Explain how the request flows from end to end in your high level design. Also you could draw a sequence diagram using the diagramming tool to enhance your explanation...






Detailed component design

Dig deeper into 2-3 components and explain in detail how they work. For example, how well does each component scale? Any relevant algorithm or data structure you like to use for a component? Also you could draw a diagram using the diagramming tool to enhance your design...






Trade offs/Tech choices

Explain any trade offs you have made and why you made certain tech choices...






Failure scenarios/bottlenecks

Try to discuss as many failure scenarios/bottlenecks as possible.






Future improvements

What are some future improvements you would make? How would you mitigate the failure scenario(s) you described above?