Requirements
Functional Requirements:
- Allow reservation of a parking spot.
- Process payment for the reservation.
- Enable parking of a car in the reserved spot.
- Support early departure before reservation time expires.
- Gate check-in/out.
- Handle no show.
- Type of reservation (2wheel/4wheel)
- Details of car for which reservation is booked
If User has stayed more than registered time slot than we can charge them based on 15 minutes or 30 minutes calculator
Non-Functional Requirements:
No double booking
High availablility
Scalability what is the scale we are expecting
1000 parking and 200 slot per parking
lets say i have 10 different locations than it is 200k reservations per day.
based on that i roughly need 25-26 mb storage per day for postgres and 800 mb of redis storage which can return inquiry from users
API Design
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...
There are multiple APIs
1) User Inquiry for available slot and price based on specific time
2)Book/Hold reservation
3)Pay for Reservation
Now when car comes to our parking lot we have to save in and out and other details of that car
updateGateCarDetails which contains car intime outtime and car details and payment status
Apart from that we can have webhook for payment status updates.
one more API to free the slots wher car has not showed up.
High-Level Design
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.
HLD starts with User browsing for fetching details it will directly go to our caching layer and while booking we will redirect user requests to postgres Server and payment Requests to payment gateway and from payment gateway based on webhook we will update status in our Database.
Detailed Component Design
Deep dive into 2-3 key components. Explain how they work, how they scale, discuss tradeoffs, capacity, and any relevant algorithms or data structures.
Key component: