List functional requirements for the system (Ask the chat bot for hints if stuck.)...
List non-functional requirements for the system...
Estimate the scale of the system you are going to design...
Define what APIs are expected from the system...
POST /user: Creates a new user account.GET /spots?car_size=small: Retrieves available parking spots based on query parameters (e.g., car size could be passed as a query string instead).POST /reserve_spot: Allows users to reserve a spot.GET /{account_id}/get_spots: Retrieves the spots reserved by a specific user (account).GET /{account_id}/payments: Retrieves previous payments made by the specific user.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...
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...
id (Primary Key): Unique identifier for each username: User's nameemail: User's email (unique)password: User's hashed passwordcreated_at: Timestamp for when the account was createdid (Primary Key): Unique identifier for each parking spotlocation: Physical location of the spot (e.g., Level 1, Space A1)size: Size of the spot (e.g., small, medium, large)status: Current status of the spot (e.g., available, reserved)created_at: Timestamp for when the spot was addedid (Primary Key): Unique identifier for each reservationuser_id (Foreign Key): References Users.idspot_id (Foreign Key): References Spots.idreserved_at: Timestamp for when the spot was reservedexpires_at: Timestamp for when the reservation expiresid (Primary Key): Unique identifier for each paymentuser_id (Foreign Key): References Users.idamount: Amount paidpayment_date: Timestamp for when the payment was madestatus: Payment status (e.g., completed, pending, failed)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...
expires_at column in your Reservations table to store the time until which the reservation is valid.expires_at is less than the current timestamp).Spots table. This entry should also link to the Reservations table to maintain the relationship.Spots table back to available.Here's how the flow could look during the reservation process:
expires_at time for 5 minutes in the Reservations table.Using a pub/sub model combined with WebSockets for real-time updates is an excellent approach for maintaining an updated view of available parking spots on your users' maps. This ensures that users receive immediate feedback about any changes without needing to refresh the page manually.
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?