# eddieugly/whatsapp-order architecture

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

- Interactive diagram: https://gitdiagram.com/eddieugly/whatsapp-order
- Repository: https://github.com/eddieugly/whatsapp-order

## Overview

##### Project Type and Purpose
- This is a full-stack Laravel application with an Inertia/Vue.js-powered front end and a traditional admin back-end.
- Purpose: serve a customer-facing SPA for browsing menus, placing orders, and reading blogs; plus an admin panel for managing blogs, categories, menus, orders, users, roles/permissions, and general site settings.

##### Top-Level Structure
- Backend (PHP/Laravel)
- app/Http/Controllers: MVC controllers (Admin and Auth)
- app/Models: Eloquent models for Blog, Menu, Order, User, etc.
- config/, routes/: application configuration & route definitions (web, api, admin, auth)
- database/: migrations, factories, seeders
- storage/: file uploads, sessions, caches, logs
- resources/views: Blade root view for Inertia
- Frontend (JavaScript/Vue)
- resources/js: Vue components, pages, layouts organized under Components, Pages, Layouts
- Inertia.js bridges server-side controllers to the client
- Vite/Webpack build config (vite.config.js, postcss.config.js)
- Public/Deployment
- public/: entry point (index.php), assets (compiled JS/CSS, images)
- .env, web server (Nginx/Apache) points to public/

##### Key Architectural Patterns & Technologies
- MVC on the server (Controllers → Models → Views via Inertia)
- SPA delivered via Inertia.js + Vue.js
- Eloquent ORM for DB access
- Database migrations & seeders for schema and initial data
- Spatie Permissions package for role/permission management
- Laravel Queues (config/queue.php) for background jobs (e.g., notifications)
- File storage via Laravel Filesystem (local/public s3-ready)
- Third-party integrations: payment gateway (Flutterwave via Vue components & backend API), email notifications (config/mail.php)

##### Main Components & Interactions
- CLIENT BROWSER (Customer SPA / Admin SPA)
↔ HTTP(S) →
- WEB SERVER (Nginx/Apache + PHP-FPM)
→ Laravel entrypoint (public/index.php)
- Middleware (authentication, CSRF, Inertia)
- Controllers (Auth, Admin, Cart, Payment, etc.)
→ Services / Jobs
→ Eloquent Models
→ Database (MySQL/Postgres)
→ Filesystem (uploads, images)
→ Cache/Session Store (Redis, Memcached)
→ Queue Workers (async jobs, notifications)
→ Mailer (SMTP, Mailgun, etc.)
→ External Payment API (Flutterwave)
- BUILD TOOLCHAIN
- Vite/Webpack compiles Vue components → public/assets/app.js & app.css
- versioned & served by web server

##### Final Touches
- Related components (e.g., app/Http and app/Models under “Laravel Application”)
- Keep it modular: separate frontend, backend, data stores, external services

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Clients
    subgraph "Clients" 
        direction TB
        CustomerSPA["Customer SPA (Vue.js + Inertia)"]:::client
        AdminSPA["Admin SPA (Vue.js + Inertia)"]:::client
    end

    CustomerSPA -->|HTTP/HTTPS| WebServer
    AdminSPA -->|HTTP/HTTPS| WebServer

    %% Web Server
    WebServer["Web Server (Nginx/Apache + PHP-FPM)"]:::server

    WebServer -->|Entrypoint: public/index.php| LaravelApp

    %% Laravel Application
    subgraph "Laravel Application" 
        direction TB
        %% Middleware Layer
        subgraph "Middleware" 
            direction TB
            InertiaMW["HandleInertiaRequests"]:::server
            AuthMW["Authenticate"]:::server
            CSRFMw["VerifyCsrfToken"]:::server
        end
        %% Controllers
        subgraph "Controllers" 
            direction TB
            AdminCtrls["Admin Controllers"]:::server
            AuthCtrls["Auth Controllers"]:::server
            FrontCtrls["Frontend Controllers"]:::server
        end
        %% Core Components
        subgraph "Core" 
            direction TB
            Models["Eloquent Models"]:::datastore
            FormReqs["Form Requests"]:::server
            APIResources["API Resources"]:::server
            Notifications["NewOrderNotification (Queue Job)"]:::server
        end
    end

    %% Application Flows
    LaravelApp -->|middleware| InertiaMW
    InertiaMW --> AuthMW
    AuthMW --> CSRFMw
    CSRFMw --> AdminCtrls
    CSRFMw --> AuthCtrls
    CSRFMw --> FrontCtrls

    AdminCtrls -->|"ORM Queries"| Models
    AuthCtrls -->|"ORM Queries"| Models
    FrontCtrls -->|"ORM Queries"| Models

    Models -->|"MySQL/Postgres"| Database
    AdminCtrls -->|"Cache Get/Set"| CacheSession
    FrontCtrls -->|"Cache Get/Set"| CacheSession

    FrontCtrls -->|"Push NewOrderNotification"| Queue
    Queue -->|"Process Jobs"| QueueWorker
    QueueWorker -->|"Send Email"| Mailer
    QueueWorker -->|"Notify via NewOrderNotification"| CustomerSPA

    FrontCtrls -->|"Read/Write"| FileStorage
    FrontCtrls -->|"HTTPS API"| PaymentGateway
    AdminCtrls -->|"Manage Roles/Perms"| PermissionConfig

    %% Build Toolchain
    resourcesJS["resources/js (Vue Components/Pages/Layouts)"]:::build
    resourcesJS -->|Vite/Webpack build| BuildAssets["public/assets (app.js, app.css)"]:::build
    BuildAssets -->|Served| WebServer

    %% Data Stores
    Database["Database (MySQL/Postgres)"]:::datastore
    CacheSession["Cache/Session Store (Redis)"]:::datastore
    FileStorage["File Storage (storage/app/public)"]:::datastore

    %% External Services
    PaymentGateway["Payment Gateway (Flutterwave)"]:::external
    Mailer["Mailer (SMTP/Mailgun)"]:::external
    PermissionConfig["Spatie Permissions (config/permission.php)"]:::external

    %% Click Events
    click AdminCtrls "https://github.com/eddieugly/whatsapp-order/tree/master/app/Http/Controllers/Admin/"
    click AuthCtrls "https://github.com/eddieugly/whatsapp-order/tree/master/app/Http/Controllers/Auth/"
    click FrontCtrls "https://github.com/eddieugly/whatsapp-order/blob/master/app/Http/Controllers/CartController.php"
    click FrontCtrls "https://github.com/eddieugly/whatsapp-order/blob/master/app/Http/Controllers/MenuController.php"
    click FrontCtrls "https://github.com/eddieugly/whatsapp-order/blob/master/app/Http/Controllers/OrderController.php"
    click FrontCtrls "https://github.com/eddieugly/whatsapp-order/blob/master/app/Http/Controllers/PaymentController.php"
    click FrontCtrls "https://github.com/eddieugly/whatsapp-order/blob/master/app/Http/Controllers/ProfileController.php"
    click FrontCtrls "https://github.com/eddieugly/whatsapp-order/blob/master/app/Http/Controllers/HomeControler.php"
    click InertiaMW "https://github.com/eddieugly/whatsapp-order/blob/master/app/Http/Middleware/HandleInertiaRequests.php"
    click AuthMW "https://github.com/eddieugly/whatsapp-order/blob/master/app/Http/Middleware/Authenticate.php"
    click CSRFMw "https://github.com/eddieugly/whatsapp-order/blob/master/app/Http/Middleware/VerifyCsrfToken.php"
    click Models "https://github.com/eddieugly/whatsapp-order/tree/master/app/Models/"
    click Notifications "https://github.com/eddieugly/whatsapp-order/blob/master/app/Notifications/NewOrderNotification.php"
    click FormReqs "https://github.com/eddieugly/whatsapp-order/tree/master/app/Http/Requests/"
    click APIResources "https://github.com/eddieugly/whatsapp-order/tree/master/app/Http/Resources/"
    click Database "https://github.com/eddieugly/whatsapp-order/tree/master/database/migrations/"
    click Queue "https://github.com/eddieugly/whatsapp-order/blob/master/config/queue.php"
    click Mailer "https://github.com/eddieugly/whatsapp-order/blob/master/config/mail.php"
    click PermissionConfig "https://github.com/eddieugly/whatsapp-order/blob/master/config/permission.php"
    click resourcesJS "https://github.com/eddieugly/whatsapp-order/tree/master/resources/js/Components/"
    click BuildAssets "https://github.com/eddieugly/whatsapp-order/blob/master/vite.config.js"
    click WebServer "https://github.com/eddieugly/whatsapp-order/blob/master/public/index.php"

    %% Styles
    classDef client fill:#D5E8D4,stroke:#82B366,color:#274E13
    classDef server fill:#DAE8FC,stroke:#6C8EBF,color:#1F4E79
    classDef datastore fill:#FFF2CC,stroke:#D6B656,color:#735C0F
    classDef external fill:#F8CECC,stroke:#B85450,color:#632423
    classDef build fill:#E1D5E7,stroke:#9673A6,color:#3F3151
```
