System requirements
Functional:
- Reservation:
- Users can reserve a parking spot through the system.
- Users can complete the reservation by making a payment.
- Parking Management:
- Allocate parking spots based on user reservations.
- Handle different vehicle types.
- Entry and Exit Management:
- Track vehicle entry and exit from the parking lot.
- Error Handling:
- Address scenarios where users make reservations but don’t show up, possibly charging a fee for the first 24 hours.
Non-Functional:
Performance(latency, hight throughput), scalability(vertical/horizontal), availability, security, reliability, consistency etc
Capacity estimation
Number of parking lots = 1000
Parking lot capacity = 200
Reservation requests = 200 * 1000 = 200 000
API design
API used by user:
checkCapacity(lot_id, vechile_type, start_time, end_tine) [is_free, price] - checks if parking lot has a free spot and returns price
reserveSpot(user_id, lot_id, vechile_type, start_time, end_time) -
returns reservation_id and price. Also forwarded on 3d party payment system.
completeReservation(reservation_id, payment_token) - after payment we need to complete payment procedure
API used by parking lot:
vechile_arrived(reservation_id, time)
vechile_left(reservation_id, time)
Database design
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...
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?