The system should allocate parking space based on vehicle type and availability
The system should allow vehicles to enter and exit parking lot efficiently
The system should support payment processing for parking fees
The system should have security measures like camera and access control
The system should be able to handle large amount of vehicles at peak times
The system should be available 24/7
The system should provide fast response time for vehicle entry exit and payment
Estimate the scale of the system you are going to design...
allow 100 vehicles to be parked and 5vehicle to enter and exit the parking lot every minute
Define what APIs are expected from the system...
parkCar(car)
exitCar(car)
makePayment(car)
getNumberOfVehicles()
getNumberOfEmptySlots()
Defining the system data model early on will clarify how data will flow among different components of the system. Also you could draw an ER diagram using the diagramming tool to enhance your design...
@ParkingSlot
id: string
isEmpty: boolean
allowedVehicleType: List[String]
@Parking
id string
vehicleId string
slotId string
parkingStartTime
parkingEndTime
@Vehicle
id string
type string
@ParkingLot
name: string
rates: double
slots: List[ParkingSlot]
operatingHours: string
@payment
id string
vehicleId
slotId
parkingStartTime
parkingEndTime
parkingDuration
parkingFee
paymentMethod
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...
The parking lot service will be hosted on a server and maintains a database, the client will be able to request park car / exit car via Rest API. After calling parking car API client's car information will be post to database. When client calls exit car the service will calculate parking fees and expose an API for client to pay. Once payment is successful client will get vehicle back and database will be updated.
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...
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...
Explain any trade offs you have made and why you made certain tech choices...
Try to discuss as many failure scenarios/bottlenecks as possible.
What are some future improvements you would make? How would you mitigate the failure scenario(s) you described above?