# naderz2/mashaweer architecture

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

- Interactive diagram: https://gitdiagram.com/naderz2/mashaweer
- Repository: https://github.com/naderz2/mashaweer

## Overview

##### Project type and purpose
- This is a Laravel-based full-stack web application with two distinct user-facing fronts:
a. A bilingual marketing/public site (English + Arabic) rendered via Blade/Pug and static assets under `resources/views/front` and `public/front`.
b. An administrative back-office (CMS) built on the AdminLTE template under `app/Http/Controllers/back` + `resources/views/back` + `public/back`.
- It follows the classic MVC pattern, uses Eloquent ORM, Laravel’s routing, middleware, scheduling, queues, and optional Vue components (see `resources/js/components`).

##### File structure
- Top-level directories:
- app/ — core MVC code (Controllers, Models, Middleware, Traits, Console commands)
- resources/ — view templates (Blade, Pug), language files, JS/Sass source, Vue components
- public/ — document root; compiled assets, uploaded files, static AdminLTE & CKEditor assets
- config/, database/, storage/, bootstrap/, vendor/ — framework configuration, migrations, caches, dependencies
- routes/ — `web.php` for UI & admin routes, `api.php` if exposing REST endpoints, `console.php` for artisan commands
- Build tools: Laravel Mix (`webpack.mix.js`) compiles JS/CSS into `public/js` & `public/css`.
- Deployment configs: `.env`, `.htaccess`, `web.config`.

##### Key insights from README
- Confirms Laravel framework, core features in use: routing, DI, ORM, migrations, queues, broadcasting.

##### Detail
- Every layer: client, load balancer (if any), web server, PHP runtime, application kernel, routing, controllers (front vs. back), models, data stores, file storage, cache, queue, scheduler, external mail/broadcast services.
- Do not omit the asset build pipeline (Mix), as it’s central to front-end delivery.
- Acknowledge environment/config: `.env` drives DB, mail, cache, queue drivers—include that as a configuration block near the application core.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Clients
    Client["Browser / Mobile"]:::client
    Client -->|"HTTP(S) Request"| WebServer

    %% Web Server Layer
    WebServer["Web Server (NGINX/Apache + PHP-FPM)"]:::server
    WebServer -->|"Pass to PHP"| Kernel

    %% Application Core
    Kernel["Laravel HTTP Kernel"]:::app
    click Kernel "https://github.com/naderz2/mashaweer/blob/main/app/Http/Kernel.php"
    Kernel --> Router

    Router["Router (routes/web.php, api.php)"]:::app
    click Router "https://github.com/naderz2/mashaweer/blob/main/routes/web.php"
    click Router "https://github.com/naderz2/mashaweer/blob/main/routes/api.php"
    Router --> Controllers

    subgraph "Controllers" 
        direction TB
        FrontCtrl["Front-end Controllers"]:::app
        click FrontCtrl "https://github.com/naderz2/mashaweer/blob/main/app/Http/Controllers/front/HomeController.php"
        BackCtrl["Back-office Controllers"]:::app
        click BackCtrl "https://github.com/naderz2/mashaweer/tree/main/app/Http/Controllers/back/"
        AuthCtrl["Auth Controllers"]:::app
        click AuthCtrl "https://github.com/naderz2/mashaweer/tree/main/app/Http/Controllers/Auth/"
    end

    Controllers --> FrontCtrl
    Controllers --> BackCtrl
    Controllers --> AuthCtrl

    %% Views
    subgraph "Views"
        direction TB
        FrontViews["Blade Views - Front"]:::app
        click FrontViews "https://github.com/naderz2/mashaweer/tree/main/resources/views/front/"
        BackViews["Blade Views - Back-office"]:::app
        click BackViews "https://github.com/naderz2/mashaweer/tree/main/resources/views/back/"
        AuthViews["Auth Views"]:::app
        click AuthViews "https://github.com/naderz2/mashaweer/tree/main/resources/views/auth/"
    end

    FrontCtrl --> FrontViews
    BackCtrl --> BackViews
    AuthCtrl --> AuthViews

    %% Models & Database
    subgraph "Models & Persistence"
        direction TB
        Models["Eloquent Models"]:::app
        click Models "https://github.com/naderz2/mashaweer/tree/main/app/Models/back/"
        Database["MySQL Database"]:::datastore
    end

    Controllers --> Models
    Models <--> Database

    %% Caching
    Cache["Cache Store (file/Redis)"]:::datastore
    Controllers -->|"Cache/Session"| Cache

    %% Queue
    QueueDispatch["Queue Dispatcher"]:::app
    Controllers -->|Dispatch Job| QueueDispatch
    QueueStore["Queue Store"]:::datastore
    click QueueStore "https://github.com/naderz2/mashaweer/blob/main/config/queue.php"
    QueueDispatch --> QueueStore
    Worker["Queue Worker (artisan queue:work)"]:::app
    QueueStore --> Worker

    %% Scheduler
    Cron["Cron"]:::external
    Cron -->|"artisan schedule:run"| ScheduleKernel
    ScheduleKernel["Console Kernel (Scheduler)"]:::app
    click ScheduleKernel "https://github.com/naderz2/mashaweer/blob/main/app/Console/Kernel.php"
    ScheduleKernel -->|"Schedule Jobs"| QueueDispatch

    %% File Storage
    Uploads["Public File Storage (uploads)"]:::datastore
    Controllers -->|"File Upload/Serve"| Uploads
    click Uploads "https://github.com/naderz2/mashaweer/tree/main/public/uploads/"

    %% External Services
    Mail["SMTP Mail Service"]:::external
    click Mail "https://github.com/naderz2/mashaweer/blob/main/config/mail.php"
    Controllers -->|"Mail::"| Mail

    Broadcast["Broadcasting (Pusher/Redis)"]:::external
    Controllers -->|Broadcast Events| Broadcast

    %% Asset Pipeline
    subgraph "Asset Pipeline" 
        direction TB
        JSsrc["resources/js/app.js"]:::pipeline
        click JSsrc "https://github.com/naderz2/mashaweer/blob/main/resources/js/app.js"
        BootstrapJS["resources/js/bootstrap.js"]:::pipeline
        click BootstrapJS "https://github.com/naderz2/mashaweer/blob/main/resources/js/bootstrap.js"
        VueComp["Vue Components"]:::pipeline
        click VueComp "https://github.com/naderz2/mashaweer/blob/main/resources/js/components/ExampleComponent.vue"
        SassSrc["resources/sass/app.scss"]:::pipeline
        click SassSrc "https://github.com/naderz2/mashaweer/blob/main/resources/sass/app.scss"
        Mix["Laravel Mix (webpack.mix.js)"]:::pipeline
        click Mix "https://github.com/naderz2/mashaweer/blob/main/webpack.mix.js"
        JSdist["public/js/app.js"]:::pipeline
        click JSdist "https://github.com/naderz2/mashaweer/blob/main/public/js/app.js"
        CSSdist["public/css/app.css"]:::pipeline
        click CSSdist "https://github.com/naderz2/mashaweer/blob/main/public/css/app.css"
    end

    JSsrc --> Mix
    BootstrapJS --> Mix
    VueComp --> Mix
    SassSrc --> Mix
    Mix --> JSdist
    Mix --> CSSdist
    Client -->|"Load Assets"| JSdist
    Client -->|"Load Styles"| CSSdist

    %% Configuration
    Config["Configuration (.env, config/*.php)"]:::config
    click Config "https://github.com/naderz2/mashaweer/tree/main/config/"
    Kernel --> Config
    QueueDispatch --> Config
    ScheduleKernel --> Config

    %% Class Definitions
    classDef client fill:#C2E7FF,stroke:#3178C6,color:#000;
    classDef server fill:#D0F2C2,stroke:#28A745,color:#000;
    classDef app fill:#FFE5B4,stroke:#FF8C00,color:#000;
    classDef datastore fill:#E6D0F2,stroke:#6F42C1,color:#000;
    classDef external fill:#E2E3E5,stroke:#6C757D,color:#000;
    classDef pipeline fill:#FFF3CD,stroke:#FFC107,color:#000;
    classDef config fill:#F8D7DA,stroke:#DC3545,color:#000;
```
