# wiggle22/parking_lot_system architecture

> Architecture diagram of the GitHub repository wiggle22/parking_lot_system, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-03). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/wiggle22/parking_lot_system
- Repository: https://github.com/wiggle22/parking_lot_system

## Overview

##### Project Type and Purpose
- The project is a hybrid full-stack system with a strong embedded/hardware component. It integrates an Arduino-based hardware layer (using Arduino Mega 2560, ESP32, IR sensors, servo motors, RFID, and LCD) for real-time parking spot detection and management with a Django web application for user-facing functionalities (reservation, status checking, and administrative controls).
- Technologies include C (for Arduino programming), Python/Django (using an MVT design pattern for the web app), and Node.js (possibly for additional server-side interactions).

##### File Structure
- The top-level directories – “desktopapp”, “django”, and “nodejs” – indicate separate components. The “django” directory is extensive and contains several Django apps:
- Main project components (VehicleParking, projectApp, api, signup, and vnpay) which clearly segregate different functionalities such as account management, API endpoints, payment (vnpay), and the main business logic.
- Standard Django directories such as “migrations”, “templates”, “static”, and “urls” emphasize a well-organized MVT architecture.
- The “desktopapp” directory (with app.py) may represent a support tool or an administrative desktop application.
- The “nodejs” directory suggests an additional server-side functionality (perhaps for real-time updates, notifications, or socket connections).

##### Examining the README
- The README describes how the hardware interacts with the software. It highlights that the embedded system (Arduino Mega 2560) communicates via UART with the Django-based web application. It also explains that sensor data is continually updated on the website.
- Detailed hardware components include IR sensors, servo-controlled barriers, RFID for access control, and an LCD for direct user display.
- The website is designed for real-time parking availability, reservations, and multi-tiered user management (admin, lot owner, customer). It clearly follows the MVT pattern typical of Django.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Hardware Layer
    subgraph "Hardware Layer"
        HW["Hardware: Arduino/ESP32 & Sensors"]:::hardware
    end

    %% Communication Bridge
    UART["UART Communication"]:::bridge

    %% Software Layer
    subgraph "Software Layer"
        DJS["Django Backend"]:::backend
        subgraph "Django Backend Apps"
            PA["ProjectApp (Core Parking Functions)"]:::djangoApp
            API["API Module"]:::djangoApp
            SIGN["Signup Module"]:::djangoApp
            VN["VNPAY Payment Module"]:::djangoApp
        end
        DB["Database"]:::database
        DA["Desktop Application"]:::desktopApp
        NJ["Node.js Real-time Module"]:::nodejs
    end

    %% Data Flow Connections
    HW -->|"UART"| UART
    UART --> DJS

    DJS --> PA
    DJS --> API
    DJS --> SIGN
    DJS --> VN

    DJS --> DB
    DJS --> DA
    DJS --> NJ

    %% Click Events
    click DJS "https://github.com/wiggle22/parking_lot_system/tree/main/django/VehicleParking/VehicleParking"
    click PA "https://github.com/wiggle22/parking_lot_system/tree/main/django/VehicleParking/projectApp"
    click API "https://github.com/wiggle22/parking_lot_system/tree/main/django/VehicleParking/api"
    click SIGN "https://github.com/wiggle22/parking_lot_system/tree/main/django/VehicleParking/signup"
    click VN "https://github.com/wiggle22/parking_lot_system/tree/main/django/VehicleParking/vnpay"
    click DA "https://github.com/wiggle22/parking_lot_system/blob/main/desktopapp/app.py"
    click NJ "https://github.com/wiggle22/parking_lot_system/tree/main/nodejs"

    %% Styles
    classDef hardware fill:#f9c74f,stroke:#000,stroke-width:2px;
    classDef bridge fill:#90be6d,stroke:#000,stroke-width:2px;
    classDef backend fill:#f9844a,stroke:#000,stroke-width:2px;
    classDef djangoApp fill:#277da1,stroke:#000,stroke-width:2px;
    classDef database fill:#f94144,stroke:#000,stroke-width:2px;
    classDef desktopApp fill:#90d5ec,stroke:#000,stroke-width:2px;
    classDef nodejs fill:#a0c4ff,stroke:#000,stroke-width:2px;
```
