# prajwalhire-dev/reservation architecture

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

- Interactive diagram: https://gitdiagram.com/prajwalhire-dev/reservation
- Repository: https://github.com/prajwalhire-dev/reservation

## Overview

##### Project type and purpose
- This is a full-stack Django web application named “reservation.”
- Purpose: allow engineers to make reservations (e.g., testbed reservations) via a web UI and automatically notify them of key events via a Webex bot.

##### File structure
Top level:
- manage.py, reservation/ → Django project settings, ASGI/WSGI, Celery integration
- reservationDashboard/ → primary Django app: models, views, forms, admin, custom management commands, Celery tasks, migrations, URL routes, templates under templates/reservation/
- testbed/ → secondary app: testbed data, admin, views, URLs
- static/ & templates/ → compiled CSS/JS assets (Hope-UI, plugins) and HTML templates (base, auth, plugins, reservation, testbed)
- celerybeat-schedule.* → on-disk Celery beat state
- requirements.txt → Python dependencies (Django, Celery, requests or Webex SDK, etc.)

Architectural hints:
– Django’s MTV (Model-Template-View) pattern
– Celery with a beat scheduler for periodic tasks
– Custom management command to bootstrap users
– Asynchronous notifications via Webex API

##### README
- Confirms high scalability and robustness
- Mentions Webex bot integration for real-time notifications

##### Components
a. Main components
1. User’s browser (UI)
2. Web server / load balancer (e.g., Nginx or CDN)
3. Django application (reservation project)
- Django apps: reservationDashboard & testbed
- URL router, views, forms, templates
4. Static asset service (served by Nginx or Django’s collectstatic)
5. Relational database (PostgreSQL/MySQL)
6. Cache/Broker service (Redis or RabbitMQ)
7. Celery worker pool
8. Celery beat scheduler
9. External Webex Bot API
10. Optional: object store (S3) if large media or assets

b. Relationships & data flows
- HTTP(S) between Browser ↔ Load Balancer/Nginx ↔ Django (ASGI/WSGI)
- Django ORM generates SQL ↔ Database
- Django → publish tasks (via AMQP/Redis) → Broker
- Broker → Celery workers execute async tasks
- Celery beat → schedule periodic tasks (e.g., cleanup, daily reports)
- Celery tasks → Webex Bot API (HTTPS) to send notifications
- Static files (CSS/JS/images) served either by Nginx or CDN

c. Architectural patterns & principles
- MVC/MTV separation (models, views, templates)
- Layered architecture: Presentation (templates+static), Application logic (views+tasks), Data (models+DB)
- Asynchronous processing via Celery for decoupling UI from notifications
- Modular apps for separation of concerns (reservationDashboard vs. testbed)
- Management command for idempotent setup of system users

d. Key technologies & frameworks
- Python 3.x, Django (core web framework)
- Celery (async task queue) + Celery beat (scheduler)
- Redis or RabbitMQ (broker & optional cache)
- PostgreSQL or MySQL (relational DB)
- Hope-UI + custom CSS/JS front end assets
- Webex Python SDK or REST calls for bot notifications
- Nginx or CDN for static file/library offloading

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend Layer
    Browser["User's Browser"]:::frontend
    LoadBalancer["Load Balancer / Nginx"]:::compute

    %% Backend Layer
    subgraph "Django Application" 
        direction TB
        ManagePy["manage.py"]:::compute
        Settings["settings.py"]:::compute
        ASGI["asgi.py"]:::compute
        WSGI["wsgi.py"]:::compute
        URLs["urls.py"]:::compute

        subgraph "Apps"
            direction TB
            subgraph "reservationDashboard App"
                direction TB
                RD_Models["models.py"]:::compute
                RD_Views["views.py"]:::compute
                RD_Forms["forms.py"]:::compute
                RD_Admin["admin.py"]:::compute
                RD_Urls["urls.py"]:::compute
                RD_Tasks["tasks.py"]:::compute
                RD_Setup["management/commands/setup_users.py"]:::compute
                RD_Migrations["migrations/"]:::compute
            end
            subgraph "testbed App"
                direction TB
                TB_Models["models.py"]:::compute
                TB_Views["views.py"]:::compute
                TB_Admin["admin.py"]:::compute
                TB_Urls["urls.py"]:::compute
                TB_Migrations["migrations/"]:::compute
            end
        end
    end

    StaticService["Static Asset Service (Hope-UI & Plugins)"]:::static
    Database["PostgreSQL / MySQL"]:::datastore
    Broker["Redis / RabbitMQ (Broker)"]:::datastore

    subgraph "Celery"
        direction TB
        Worker["Celery Worker Pool"]:::compute
        Beat["Celery Beat Scheduler"]:::compute
        CeleryConfig["celery.py"]:::compute
        ScheduleBak["celerybeat-schedule.bak"]:::datastore
        ScheduleDat["celerybeat-schedule.dat"]:::datastore
        ScheduleDir["celerybeat-schedule.dir"]:::datastore
    end

    WebexAPI["External Webex Bot API"]:::external

    %% Connections
    Browser -->|HTTPS| LoadBalancer
    LoadBalancer -->|WSGI/ASGI| ASGI
    ASGI -->|routes| URLs
    URLs -->|calls| RD_Views
    URLs -->|calls| TB_Views
    RD_Views -->|uses ORM| RD_Models
    TB_Views -->|uses ORM| TB_Models
    RD_Views -->|renders| StaticService
    RD_Views -->|renders| Templates
    RD_Views -->|renders| Templates
    ASGI -->|collectstatic| StaticService

    RD_Views -->|DB queries| Database
    TB_Views -->|DB queries| Database

    RD_Views -->|enqueue tasks| Broker
    RD_Tasks -->|enqueue tasks| Broker

    Broker -->|dispatch| Worker
    Beat -->|schedule| Broker
    CeleryConfig -->|configures| Worker
    CeleryConfig -->|configures| Beat
    ScheduleBak -->|state| Beat
    ScheduleDat -->|state| Beat
    ScheduleDir -->|state| Beat

    Worker -->|HTTPS| WebexAPI

    %% Templates Node Group
    subgraph "Templates"
        direction TB
        T_Base["base.html"]:::static
        T_Dashboard["dashboard.html"]:::static
        T_Login["login.html"]:::static
        T_Register["register.html"]:::static
        T_Reservation["reservation.html"]:::static
        T_ReservationTable["reservation_table.html"]:::static
        T_Testbed["overview.html"]:::static
        T_PluginApex["apexcharts.html"]:::static
        T_PluginSelect["select2.html"]:::static
    end

    %% Click Events
    click ManagePy "https://github.com/prajwalhire-dev/reservation/blob/main/manage.py"
    click Settings "https://github.com/prajwalhire-dev/reservation/blob/main/reservation/settings.py"
    click ASGI "https://github.com/prajwalhire-dev/reservation/blob/main/reservation/asgi.py"
    click WSGI "https://github.com/prajwalhire-dev/reservation/blob/main/reservation/wsgi.py"
    click URLs "https://github.com/prajwalhire-dev/reservation/blob/main/reservation/urls.py"

    click CeleryConfig "https://github.com/prajwalhire-dev/reservation/blob/main/reservation/celery.py"
    click ScheduleBak "https://github.com/prajwalhire-dev/reservation/blob/main/celerybeat-schedule.bak"
    click ScheduleDat "https://github.com/prajwalhire-dev/reservation/blob/main/celerybeat-schedule.dat"
    click ScheduleDir "https://github.com/prajwalhire-dev/reservation/blob/main/celerybeat-schedule.dir"

    click RD_Models "https://github.com/prajwalhire-dev/reservation/blob/main/reservationDashboard/models.py"
    click RD_Views "https://github.com/prajwalhire-dev/reservation/blob/main/reservationDashboard/views.py"
    click RD_Forms "https://github.com/prajwalhire-dev/reservation/blob/main/reservationDashboard/forms.py"
    click RD_Admin "https://github.com/prajwalhire-dev/reservation/blob/main/reservationDashboard/admin.py"
    click RD_Urls "https://github.com/prajwalhire-dev/reservation/blob/main/reservationDashboard/urls.py"
    click RD_Tasks "https://github.com/prajwalhire-dev/reservation/blob/main/reservationDashboard/tasks.py"
    click RD_Setup "https://github.com/prajwalhire-dev/reservation/blob/main/reservationDashboard/management/commands/setup_users.py"
    click RD_Migrations "https://github.com/prajwalhire-dev/reservation/tree/main/reservationDashboard/migrations/"

    click TB_Models "https://github.com/prajwalhire-dev/reservation/blob/main/testbed/models.py"
    click TB_Views "https://github.com/prajwalhire-dev/reservation/blob/main/testbed/views.py"
    click TB_Admin "https://github.com/prajwalhire-dev/reservation/blob/main/testbed/admin.py"
    click TB_Urls "https://github.com/prajwalhire-dev/reservation/blob/main/testbed/urls.py"
    click TB_Migrations "https://github.com/prajwalhire-dev/reservation/tree/main/testbed/migrations/"

    click StaticService "https://github.com/prajwalhire-dev/reservation/blob/main/static/assets/css/hope-ui.min1fc6.css"
    %% Note: directory for images and plugins not specific files

    click T_Base "https://github.com/prajwalhire-dev/reservation/blob/main/templates/base/base.html"
    click T_Dashboard "https://github.com/prajwalhire-dev/reservation/blob/main/templates/base/dashboard.html"
    click T_Login "https://github.com/prajwalhire-dev/reservation/blob/main/templates/auth/login.html"
    click T_Register "https://github.com/prajwalhire-dev/reservation/blob/main/templates/auth/register.html"
    click T_Reservation "https://github.com/prajwalhire-dev/reservation/blob/main/templates/reservation/reservation.html"
    click T_ReservationTable "https://github.com/prajwalhire-dev/reservation/blob/main/templates/reservation/reservation_table.html"
    click T_Testbed "https://github.com/prajwalhire-dev/reservation/blob/main/templates/testbed/overview.html"
    click T_PluginApex "https://github.com/prajwalhire-dev/reservation/blob/main/templates/plugins/apexcharts.html"
    click T_PluginSelect "https://github.com/prajwalhire-dev/reservation/blob/main/templates/plugins/select2.html"

    %% Styles
    classDef frontend fill:#CFE2F3,stroke:#6FA8DC,stroke-width:1px;
    classDef compute fill:#D9EAD3,stroke:#6AA84F,stroke-width:1px;
    classDef datastore fill:#EAD1DC,stroke:#A64D79,stroke-width:1px;
    classDef external fill:#FFE599,stroke:#BF9000,stroke-width:1px;
    classDef static fill:#F4CCCC,stroke:#CC0000,stroke-width:1px;
```
