# romelgo/chambea-ya architecture

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

- Interactive diagram: https://gitdiagram.com/romelgo/chambea-ya
- Repository: https://github.com/romelgo/chambea-ya

## Overview

##### Main System Components
- Web Client (Browser / Mobile)
- Load Balancer / Web Server (Apache/nginx + .htaccess)
- Laravel App Server (PHP-FPM)
- Vue.js Frontend (served via Blade templates + standalone SPA assets)
- MySQL Database
- File Storage (local / public/uploads)
- Caching Layer (Laravel cache, e.g. file/Redis)
- Queue Worker(s) (php artisan queue:work)
- Mail Service (SMTP / external provider)
- Optional: API Server (routes/api.php + Sanctum tokens)

##### Relationships & Data Flows
- Client → HTTP(S) → Load Balancer/Web Server
- Hosts static assets (public/) and proxies PHP requests.
- Web Server → PHP-FPM → Laravel Kernel
- Kernel dispatches through Middleware → Controllers → Models → Database / Cache / Storage.
- Laravel → MySQL
- All CRUD operations, migrations, relationships.
- Laravel → File Storage
- User-uploaded resumes, avatars in storage/app/public → served via public/uploads.
- Laravel → Cache
- Session data, route caching, query caching.
- Laravel → Queue Worker
- Jobs (e.g., SendJob email) pushed to queue table, processed asynchronously.
- Laravel → Mail Service
- Outgoing notifications, application confirmations (app/Mail).
- Client ← REST JSON APIs
- Vue components (resources/js) may call API endpoints (routes/api.php) for dynamic features.

##### Architectural Patterns
- MVC Pattern:
- Models (app/Models)
- Views (resources/views + Vue templates)
- Controllers (app/Http/Controllers)
- Middleware Chain:
- Authentication (Sanctum, session), CSRF, role guards (Seeker, Employer, Admin).
- Service Providers / IoC Container (app/Providers)
- Blade + Vue Hybrid:
- Blade drives page shells; Vue components handle dynamic widgets.
- RESTful Routes + API
- Separate web (routes/web.php, routes/admin.php) & API layers.

##### Technologies & Frameworks to Annotate
- Laravel 10.x (PHP 8.x)
- Vue.js (2.x/3.x via Vite)
- MySQL (or MariaDB)
- Composer, NPM, Vite.js
- Mailer: SwiftMailer / Mailgun / SMTP
- Queue: Database or Redis driver
- Cache: file or Redis (config/cache.php)
- Authentication: Laravel Sanctum + default guards

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Compute Layer
    subgraph "Compute Layer"
        direction TB
        LoadBalancer["Load Balancer/Web Server<br>(Apache/nginx)"]:::backend
        VueJS["Vue.js Frontend<br>(Blade + SPA assets)"]:::frontend
        PHPFPM["Laravel PHP-FPM<br>App Server"]:::backend
        QueueWorker["Queue Worker(s)"]:::backend
    end

    %% Persistence Layer
    subgraph "Persistence Layer"
        direction TB
        MySQL["MySQL Database<br>TCP:3306"]:::data
        Storage["File Storage<br>(local / public/uploads)"]:::storage
        Cache["Cache Layer<br>(file/Redis)"]:::storage
    end

    %% External Services
    subgraph "External Services"
        direction TB
        MailService["Mail Service<br>(SMTP / external)"]:::external
    end

    %% Client
    WebClient["Web Client<br>(Browser/Mobile)"]:::frontend

    %% API Server
    API["API Server<br>(routes/api.php, Sanctum)"]:::backend

    %% Flows
    WebClient -->|HTTP/HTTPS| LoadBalancer
    LoadBalancer -->|serves assets| VueJS
    LoadBalancer -->|proxies PHP| PHPFPM
    WebClient -->|REST JSON| API
    API -->|invokes| PHPFPM

    PHPFPM -->|CRUD| MySQL
    PHPFPM -->|store files| Storage
    PHPFPM -->|cache| Cache
    PHPFPM -->|dispatch jobs| QueueWorker
    PHPFPM -->|send mails| MailService

    QueueWorker -.->|process jobs| PHPFPM

    %% Click Events
    click WebClient "https://github.com/romelgo/chambea-ya/blob/main/public/index.php"
    click WebClient "https://github.com/romelgo/chambea-ya/blob/main/resources/js/app.js"
    click WebClient "https://github.com/romelgo/chambea-ya/tree/main/resources/js/components/"
    click WebClient "https://github.com/romelgo/chambea-ya/blob/main/resources/css/app.css"
    click LoadBalancer "https://github.com/romelgo/chambea-ya/blob/main/.htaccess"
    click LoadBalancer "https://github.com/romelgo/chambea-ya/blob/main/public/.htaccess"
    click PHPFPM "https://github.com/romelgo/chambea-ya/blob/main/bootstrap/app.php"
    click PHPFPM "https://github.com/romelgo/chambea-ya/tree/main/artisan"
    click PHPFPM "https://github.com/romelgo/chambea-ya/blob/main/app/Http/Kernel.php"
    click VueJS "https://github.com/romelgo/chambea-ya/blob/main/resources/js/app.js"
    click VueJS "https://github.com/romelgo/chambea-ya/blob/main/resources/js/bootstrap.js"
    click VueJS "https://github.com/romelgo/chambea-ya/blob/main/resources/js/components/*.vue"
    click VueJS "https://github.com/romelgo/chambea-ya/blob/main/vite.config.js"
    click VueJS "https://github.com/romelgo/chambea-ya/blob/main/resources/views/layouts/main.blade.php"
    click MySQL "https://github.com/romelgo/chambea-ya/blob/main/config/database.php"
    click MySQL "https://github.com/romelgo/chambea-ya/tree/main/database/migrations/"
    click MySQL "https://github.com/romelgo/chambea-ya/tree/main/app/Models/"
    click Storage "https://github.com/romelgo/chambea-ya/blob/main/config/filesystems.php"
    click Storage "https://github.com/romelgo/chambea-ya/tree/main/storage/app/public/"
    click Storage "https://github.com/romelgo/chambea-ya/tree/main/public/uploads/"
    click Cache "https://github.com/romelgo/chambea-ya/blob/main/config/cache.php"
    click Cache "https://github.com/romelgo/chambea-ya/tree/main/storage/framework/cache/"
    click QueueWorker "https://github.com/romelgo/chambea-ya/blob/main/config/queue.php"
    click QueueWorker "https://github.com/romelgo/chambea-ya/blob/main/database/migrations/2019_08_19_000000_create_failed_jobs_table.php"
    click QueueWorker "https://github.com/romelgo/chambea-ya/blob/main/app/Console/Kernel.php"
    click MailService "https://github.com/romelgo/chambea-ya/blob/main/config/mail.php"
    click MailService "https://github.com/romelgo/chambea-ya/blob/main/app/Mail/SendJob.php"
    click MailService "https://github.com/romelgo/chambea-ya/blob/main/resources/views/email/jobEmail.blade.php"
    click API "https://github.com/romelgo/chambea-ya/blob/main/routes/api.php"
    click API "https://github.com/romelgo/chambea-ya/blob/main/config/sanctum.php"
    click API "https://github.com/romelgo/chambea-ya/tree/main/app/Http/Controllers/Auth/"

    %% Styles
    classDef frontend fill:#D6EAF8,stroke:#21618C,color:#1B4F72;
    classDef backend fill:#FADBD8,stroke:#B03A2E,color:#641E16;
    classDef data fill:#D5F5E3,stroke:#196F3D,color:#145A32;
    classDef storage fill:#FCF3CF,stroke:#B9770E,color:#7E5109;
    classDef external fill:#FDEDEC,stroke:#922B21,color:#641E16;
```
