# pavanvattikala/foodease architecture

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

- Interactive diagram: https://gitdiagram.com/pavanvattikala/foodease
- Repository: https://github.com/pavanvattikala/foodease

## Overview

##### Project type and purpose
- Food Ease is a full-stack, Laravel-based restaurant management web application. It provides role-based UIs (Admin, Waiter, Biller, Kitchen, POS) for table management, order entry, real-time kitchen updates, bill generation, and printing via thermal/KOT printers.

##### File structure
- Top-level Laravel directories:
- app/ (Controllers, Models, Events, Jobs, Helpers, Enums, Middleware, Requests, Providers, View Components)
- resources/ (Blade views, JS/CSS assets)
- public/ (compiled assets, entry point index.php)
- routes/ (web.php, api.php, others)
- config/, bootstrap/, database/, storage/
- docker/ (Dockerfiles for PHP 7.4–8.1)
- Architectural patterns & modules:
- MVC (Models in app/Models, Controllers app/Http/Controllers, Views in resources/views)
- Event-driven & queue-based printing (app/Events, app/Jobs, app/Helpers/Printers)
- Real-time updates via Pusher (configured in .env, config/broadcasting.php)
- Role-based middleware (Admin, Biller, Kitchen, Waiter under app/Http/Middleware)
- Modular Blade components for layouts per role (app/View/Components & resources/views/layouts)

##### README insights
- Real-time order broadcast (Pusher) for Kitchen module
- Docker support for containerized PHP environments
- Asset pipeline: Laravel Mix (webpack.mix.js), Tailwind, custom JS for POS, kitchen, order flows
- Authentication: Laravel Fortify/Sanctum (auth controllers, password reset, email verification)

a. Main components
- Clients (Web browsers/mobile shortcuts)
– Role-specific frontends: Admin Dashboard, Waiter Mobile UI, Kitchen Display, POS terminal, Biller UI
- Load Balancer / Web Server (optional if scaled) → Nginx/Apache (serving public/index.php within container)
- Laravel Application
– HTTP layer (Routes → Controllers → Services → Models → MySQL)
– Event Bus (Laravel Events → Pusher/Broadcast channels)
– Queue Worker (Jobs for printing, bill saving, email notifications)
- Data Stores
– Relational DB (MySQL/PostgreSQL via config/database.php)
– File storage (local storage for PDFs, backups)
– Cache/Session store (Redis or file based)
- External Services & Integrations
– Pusher (real-time channels)
– Printer Agents (thermal printers, KOT printers run via Supervisord in Docker)
– Email/SMS (mail driver configured in config/mail.php)
b. Relationships & interactions
- User action in browser → HTTP API call to Laravel → Controller logic → DB read/write → Response → Blade view or JSON
- Order submission → Laravel Event dispatched → Pusher pushes to Kitchen frontend → Kitchen UI updates in real time
- Printing job enqueued → Queue Worker picks up → uses Printer helper to format and send to thermal/KOT printers
c. Architectural patterns & design principles
- MVC separation of concerns
- Event-driven & asynchronous processing (Jobs & Queues)
- Pub/Sub for real-time updates
- Role-based access via middleware
- Component-based UI (Blade components)
- Dockerized services for consistent dev/prod environments
d. Key technologies/frameworks
- Laravel 8.x (PHP 7.4–8.1)
- Blade templating, Laravel Mix (Webpack), Tailwind CSS
- Pusher for WebSocket broadcasting
- MySQL or equivalent RDBMS
- Supervisord for managing print agent processes in Docker

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Clients Layer
    subgraph "Clients" 
        direction TB
        AdminUI["Admin Dashboard UI"]:::clients
        WaiterUI["Waiter Mobile UI"]:::clients
        KitchenUI["Kitchen Display UI"]:::clients
        POSUI["POS Terminal UI"]:::clients
        BillerUI["Biller UI"]:::clients
    end

    %% Server Layer
    subgraph "Server (Docker Containers)" 
        direction TB
        WebServer["Nginx/Apache Web Server"]:::server
        subgraph "Laravel Application" 
            direction TB
            HTTP["HTTP Routing Layer"]:::server
            Middleware["Role-based Middleware"]:::server
            Controllers["Controllers"]:::server
            EventBus["Event Bus"]:::server
            QueueWorker["Queue Worker"]:::server
            ConfigServices["Configuration Services"]:::server
        end
    end

    %% Data Stores
    subgraph "Data Stores"
        direction TB
        DB["Relational DB (MySQL/PostgreSQL)"]:::datastore
        Cache["Cache/Session Store (Redis)"]:::datastore
        Storage["File Storage & Backups"]:::datastore
    end

    %% External Services
    subgraph "External Services"
        direction TB
        Pusher["Pusher (WebSocket)"]:::external
        PrinterAgent["Printer Agents"]:::external
        EmailSMS["Email/SMS Service"]:::external
    end

    %% Connections: Clients to Server
    AdminUI -->|HTTP/REST| WebServer
    WaiterUI -->|HTTP/REST| WebServer
    KitchenUI -->|HTTP/REST| WebServer
    POSUI -->|HTTP/REST| WebServer
    BillerUI -->|HTTP/REST| WebServer

    %% WebServer to Laravel
    WebServer -->|index.php| HTTP
    HTTP -->|route matching| Middleware
    Middleware -->|authorization| Controllers
    Controllers -->|ORM queries| DB
    Controllers -->|render views / JSON| AdminUI
    Controllers -->|render views / JSON| WaiterUI
    Controllers -->|render views / JSON| KitchenUI
    Controllers -->|render views / JSON| POSUI
    Controllers -->|render views / JSON| BillerUI

    %% Background & Real-time
    Controllers -->|dispatch event| EventBus
    EventBus -->|broadcast via WebSocket| Pusher
    Pusher -->|push updates| KitchenUI

    Controllers -->|enqueue job| QueueWorker
    QueueWorker -->|process job| PrinterAgent
    QueueWorker -->|send email| EmailSMS

    %% Config and Data Stores
    ConfigServices -->|db config| DB
    ConfigServices -->|cache config| Cache
    ConfigServices -->|storage config| Storage
    ConfigServices -->|broadcast config| Pusher
    ConfigServices -->|queue config| QueueWorker
    ConfigServices -->|mail config| EmailSMS

    %% Click Events
    click AdminUI "https://github.com/pavanvattikala/foodease/tree/main/resources/views/admin"
    click WaiterUI "https://github.com/pavanvattikala/foodease/tree/main/resources/views/waiter"
    click KitchenUI "https://github.com/pavanvattikala/foodease/blob/main/resources/views/kitchen/index.blade.php"
    click POSUI "https://github.com/pavanvattikala/foodease/tree/main/resources/views/pos"
    click BillerUI "https://github.com/pavanvattikala/foodease/blob/main/resources/views/biller/index.blade.php"
    click HTTP "https://github.com/pavanvattikala/foodease/blob/main/routes/web.php"
    click HTTP "https://github.com/pavanvattikala/foodease/blob/main/routes/api.php"
    click HTTP "https://github.com/pavanvattikala/foodease/blob/main/routes/channels.php"
    click Controllers "https://github.com/pavanvattikala/foodease/tree/main/app/Http/Controllers"
    click Models "https://github.com/pavanvattikala/foodease/tree/main/app/Models"
    click EventBus "https://github.com/pavanvattikala/foodease/tree/main/app/Events"
    click EventBus "https://github.com/pavanvattikala/foodease/blob/main/config/broadcasting.php"
    click QueueWorker "https://github.com/pavanvattikala/foodease/tree/main/app/Jobs"
    click QueueWorker "https://github.com/pavanvattikala/foodease/blob/main/config/queue.php"
    click PrinterAgent "https://github.com/pavanvattikala/foodease/tree/main/app/Helpers/Printers"
    click PrinterAgent "https://github.com/pavanvattikala/foodease/blob/main/docker/7.4/supervisord.conf"
    click PrinterAgent "https://github.com/pavanvattikala/foodease/blob/main/docker/8.0/supervisord.conf"
    click PrinterAgent "https://github.com/pavanvattikala/foodease/blob/main/docker/8.1/supervisord.conf"
    click Middleware "https://github.com/pavanvattikala/foodease/blob/main/app/Http/Middleware/Admin.php"
    click Middleware "https://github.com/pavanvattikala/foodease/blob/main/app/Http/Middleware/BillerMiddleware.php"
    click Middleware "https://github.com/pavanvattikala/foodease/blob/main/app/Http/Middleware/KitchenMiddleware.php"
    click Middleware "https://github.com/pavanvattikala/foodease/blob/main/app/Http/Middleware/WaiterMiddleware.php"
    click ConfigServices "https://github.com/pavanvattikala/foodease/blob/main/config/database.php"
    click ConfigServices "https://github.com/pavanvattikala/foodease/blob/main/config/cache.php"
    click ConfigServices "https://github.com/pavanvattikala/foodease/blob/main/config/mail.php"
    click ConfigServices "https://github.com/pavanvattikala/foodease/blob/main/config/broadcasting.php"
    click ConfigServices "https://github.com/pavanvattikala/foodease/blob/main/config/queue.php"
    click Storage "https://github.com/pavanvattikala/foodease/tree/main/storage/app"
    click Storage "https://github.com/pavanvattikala/foodease/tree/main/storage/backups"

    %% Styles
    classDef clients fill:#ADD8E6,stroke:#333,stroke-width:1px
    classDef server fill:#90EE90,stroke:#333,stroke-width:1px
    classDef datastore fill:#FFA500,stroke:#333,stroke-width:1px
    classDef external fill:#DDA0DD,stroke:#333,stroke-width:1px
```
