Capacity Estimation
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...
Checks for availability of a parking spot. lot _type refers to parking lot type for small/large vehicles. Return a boolean true/false if lot is available
GET api/parking/{parking-lot-id}
JSON payload - {
"lot-type": type,
"duration": time
}
Reserves a spot in a parking lot for a particular user and vehicle.
Returns reservation _id
Check in for a parking at a slot. Validates if the check in is valid. Returns true for a valid checkin else false.
check out from a parking slot
POST request POST /api/parking/{parking-lot-id}/checkout
JSON payload - {
"reservation_id": rid,
"checkout_time": time
}
Response - Success 200 OK
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.
Database Design
User flow-
Deep dive into 2-3 key components. Explain how they work, how they scale, discuss tradeoffs, capacity, and any relevant algorithms or data structures.
Database- the data for the parking lot details is relatively stable , with no frequent changes.
Given that we want strong consistency, we can go with SQL databases like postgreSQL.
Database size - 10* 100 * 200 *200 =-40,000,000 entries at max per day for reservations. 1kb per entry - 40 gb of data