System requirements


Functional:

  1. User Registration and Authentication: Allow users to create accounts, log in, and manage their profiles.
  2. Real-Time Parking Availability: Provide real-time data regarding available parking spaces, including the types of vehicles that can occupy those spaces.
  3. Entry and Exit Management: Implement a mechanism for vehicles to enter and exit the parking lot smoothly, potentially using automated gates or ticket dispensers.
  4. Parking Space Allocation: Develop an algorithm that allocates the nearest available parking space to a vehicle based on user preferences and vehicle types.
  5. Payment Processing: Enable users to pay for parking either through the app or at payment kiosks. This could include options for hourly, daily, or monthly payments.
  6. Reservation System: Allow users to reserve parking spaces in advance to guarantee availability.
  7. User Notifications: Send notifications to users about parking confirmations, payment receipts, and reminders for when their parking time is about to expire.
  8. Reporting and Analytics: Provide administrators with dashboards for managing parking space usage, payment statistics, and user behavior.
  9. Accessibility Features: Ensure the system is accessible for all users, including those with disabilities. This includes dedicated spaces and features in the application for easy navigation.




Non-Functional:

  1. Scalability: The system should be able to handle an increasing number of users and vehicles without a significant drop in performance. This includes being prepared for peak times such as holidays or events.
  2. Performance: The system should respond to user requests quickly. For instance, responses for parking space inquiries should ideally be delivered within a few seconds.
  3. Security: Implementing robust security measures is essential. This includes protecting user data, ensuring secure payment transactions, and preventing unauthorized access to the system.
  4. Usability: The system should provide a user-friendly interface that is intuitive and easy to use for all users, including support for mobile devices.
  5. Maintainability: The architecture should be designed to allow for easy updates and maintenance. This includes well-documented code and modular components.
  6. Reliability: The system should be robust enough to operate correctly under a variety of conditions, including handling failures of components gracefully without complete service disruption.
  7. Interoperability: The ability for the parking lot system to integrate with other systems, such as mobile payment platforms, navigation apps, or city-wide transport systems.
  8. Auditability: The system should maintain logs of transactions and user actions to facilitate tracking and auditing, which can be important for both security and operational reviews.
  9. Compliance: The system needs to adhere to relevant regulations, including data protection laws such as GDPR or PCI-DSS for payment processing.





Capacity estimation

  1. Total Parking Spaces: Let's say your parking lot has a total of 200 parking spaces.
  2. Types of Vehicles:
    • Compact Cars: 120 spaces
    • Standard Cars: 60 spaces
    • Handicapped Accessible: 10 spaces
    • Electric Vehicle Charging Stations: 10 spaces


  • Normal Days: Approximately 1,000 DAUs
  • Special Events/Weekends: Up to 2,000 DAUs
  • Normal Days RPS: 1000 / 24 * 60 * 60
  • Special Events/Weekends RPS: 2000 / 24 * 60 * 60





API design

parkingLot/v1 {

request: GET

argument: {

carType,

isHandicapped,

}


returnBody: {

numberOfFreeSpaces

}

return statuses: Ok()

SystemFailure()

}


parkingLot/v1/park {

request: POST,

requestBody: {

carType,

isHandicapped,

carNumberPlate

}

return statuses: Ok(parked)

NoSpace

SystemFailure()

}






Database design

Because the special status like handicapped almost never gets changed or some other stautes added + the sizes of the cars are not chaning I poropse the following schema for in memory DB:

  ParkingLot: +int totalCapacity

  ParkingLot: +int totalAvailableSpace

  ParkingLot: +CarSpace normalAvailableSpace

  ParkingLot: +CarSpace handicappedAvailableSpace  


  CarSpace : +int freeSmall

  CarSpace : +int freeMedium

  CarSpace : +int freeLarge 

The parking lot db has no indices, because it's a pure counter db

The user schema which will reside in an sql DB will look like this:

User : +int RecordID PK

  User : +String PlateNumber KEY

  User: +bool isHandicapped

  User: +int CarSize

  User: +DateTime arrivalTime

  User: +DateTime exitTime

  User: +Char+Int lotNumber





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?