How madhank93/learn-system-design works
Project Type and Purpose
• This is a low-level design project that implements a parking lot management system, with a clear focus on object-oriented design (e.g., accounts, parking spots, vehicles, panels) as demonstrated by the file tree under low-level-design/parking-lot.
• The purpose is to design and simulate a parking lot system that includes key functionality such as entry/exit panels, toll calculations (hourly cost), ticket management, and multiple classes of vehicles and parking spots.
Analyzing the File Structure
• The top-level directories include “high-level-design” (which contains general system design concepts and prerequisites) and “low-level-design” (which contains the parking-lot domain).
• Under the low-level design, the “ts” directory in the parking lot domain holds the TypeScript code. Within “src”, you have well-organized folders for account, parking-spot, vehicles and other components like entry.panel.ts and exit.panel.ts.
• There are also configuration files (package.json, tsconfig.json, vite.config.ts) that indicate how to build and run the project, showing the usage of modern JavaScript/TypeScript tooling.
• The test directory suggests a unit testing approach that validates key functionalities (e.g., different spec files for panels, parking floors, etc.).
Extracting Key Architectural Insights from the README
• Although the README mainly provides useful reference links for system design, it confirms that the repository is intended to be a learning and design resource for system architecture and low-level design.
a. Main Components:
• Entry Point / Entry Panel: Handles the incoming vehicles registering their entry.
• Exit Point / Exit Panel: Manages and handles the vehicle exit and billing.
• Parking Lot Core: Represents the overall parking lot system, integrating various component interactions.
• Accounts: Different types of account modules (admin, parking attendant) used for managing system operations.
• Parking Spots: Various specialized spots (car spot, disabled spot, electric spot, motorcycle spot) reflecting the domain distinctions.
• Vehicles: Capable of handling different vehicle types (car, electric, motorcycle, truck) corresponding to available parking spots.
• Parking Display Board: Likely a real-time representation of parking occupancy and available spots.
• Utilities: Modules like hourly cost calculation and ticketing (parking.ticket.ts).
b. Relationships and Interactions:
• Upon entry, the system allocates an appropriate Parking Spot based on vehicle type and availability.
• The Parking Lot Core manages these allocations and tracks the occupancy across different floors and spots.
• Parking Tickets are generated and later used at the Exit Panel to calculate the parking cost using the hourly cost module.
• The Accounts module (including admin and attendant functionalities) oversees managing operations, such as updating system settings or verifying usage.
• There is an overall interaction between the display board and the parking lot to show real-time information.
c. Architectural Patterns / Design Principles:
• Object-Oriented Design: Reflecting through the use of encapsulated classes for accounts, parking spots, vehicles, etc.
• Modular Structure: Separation of concerns is clear, with dedicated directories for each domain component.
• Possibly a layered architecture where user interface components (panels) separate from business logic (parking lot, cost calculation) and data management (potential ticket generation).
d. Key Technologies and Frameworks:
• TypeScript is the primary language.
• Tooling like Vite for bundling and pnpm for dependency management.
• Testing structure is present to demonstrate unit testing practices.
Final Recommendations
• That all major interactions (data flow, service calls, component responsibilities) are clearly indicated.
• Avoid unnecessary detail; however, capture all essential architectural elements as outlined.
• Use the high-level and low-level design documents as references if further clarification is needed in specific areas.