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...
The main functionality of this application:
These do come with caveats, such as handling situations where a reservation does not show up
Models:
To break it down, these are the API endpoints we will need for this:
Describe the overall system architecture. Identify the main components needed to solve the problem end-to-end. Use the diagramming tool to create a block diagram.
Design for payment processing:
Design for creating a parking reservation:
Design for check in/checkout:
Deep dive into 2-3 key components. Explain how they work, how they scale, discuss tradeoffs, capacity, and any relevant algorithms or data structures.
The check in/check out service is going to mainly serve to determine if an individual parking spot has been used. It should be straightforward when querying for a single parking lot, but we could improve it if we wanted daily reports for parking lots. We could update the service to run a daily job that would generate a document that describes the status of each parking spot in a parking lot.
The reservation system requires reads and writes to multiple tables. It has to read from multiple tables and also ensure that multiple people aren't reserving the same spot. To make sure that this doesn't happen, we would use a Redis lock on the parking spot, keyed by the spot id, user id, and set a timeout for 10 minutes. This will ensure that if a user doesn't end up reserving the spot, the spot can be reserved by a different user.