# aldydwi/fathcomp architecture

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

- Interactive diagram: https://gitdiagram.com/aldydwi/fathcomp
- Repository: https://github.com/aldydwi/fathcomp

## Overview

##### Project type and purpose
- This is a full-stack web application built on the Laravel PHP framework.
- Purpose: a multi-role service-booking platform (customers, admins, technicians) supporting authentication, bookings, payments, reports, testimonials, and dashboards.

##### File structure
- Top-level:
- public/ (entry point, static assets)
- routes/ (web, auth, console)
- app/ (HTTP layer, Controllers, Middleware, Requests, Models, Providers, Views components)
- resources/ (Blade templates, JS/CSS sources)
- database/ (migrations, seeders)
- config/, bootstrap/ (framework setup)
- tests/ (unit & feature tests)
- MVC pattern:
- Models in app/Models (Eloquent ORM)
- Views in resources/views (Blade) & app/View/Components
- Controllers in app/Http/Controllers, organized by role (Auth, User, admin, teknisi)
- Build assets: vite.config.js, package.json → compiles JS/CSS into public/build
- Env/config: .env, config/*.php for DB, cache, queue, mail, services.

##### README
- Standard Laravel boilerplate; confirms use of routing, DI container, ORM, sessions, queue, broadcasting.

a. Components
- Client (Browser/Mobile)
- Web Server (Apache/Nginx)
- Laravel App Kernel
- Routing Layer
- Middleware (authentication, authorization)
- Controllers (Auth, User, admin, teknisi)
- Requests / Validation
- Eloquent Models & Repositories
- Database (MySQL/PostgreSQL)
- Storage (local disk / S3 for BookingImage uploads)
- Cache & Session Store (Redis / file)
- Queue Worker (jobs for mail, reports)
- Frontend Assets (JS/CSS via Vite/Tailwind)
- External Services (Mail, Payment Gateway)

b. Relationships
- Client → HTTP request → Web Server → public/index.php → Laravel Kernel
- Kernel → Middleware → Routing → Controller Action
- Controller ↔ Eloquent Models → Database
- Controllers trigger Jobs → Queue Worker
- Controllers send Notifications/Mail via External Mail Service
- Views rendered by Controllers → Response to Client
- Frontend JS/CSS served from public/build

c. Architectural patterns & principles
- MVC (clear separation of concerns)
- Layered architecture (HTTP → Controllers → Domain Models → Persistence)
- Role-based modules (grouped controllers/views by user/admin/technician)
- Dependency Injection via service container (Providers)
- Event/Job queue for background processing

d. Key technologies
- PHP 8.x, Laravel framework
- Blade templating, Laravel components
- Eloquent ORM (Models, Migrations, Seeders)
- Vite & TailwindCSS for asset bundling
- MySQL (or DB configured)
- Redis (optional) for cache/queue
- External mail & payment gateways

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Public Layer
    subgraph "Public Layer"
        direction TB
        Browser["Client Browser/Mobile"]:::external
        WebServer["Web Server (Apache/Nginx)"]:::web
        PublicIndex["public/index.php"]:::web
    end

    Browser -->|"HTTP Request"| WebServer
    WebServer --> PublicIndex

    %% Application Layer
    subgraph "Application Layer"
        direction TB
        Kernel["HTTP Kernel"]:::web
        Middleware["Middleware (Auth/Authz)"]:::web
        Router["Routing Layer"]:::web
        subgraph "Controllers" 
            direction TB
            AuthCtl["Auth Module Controllers"]:::business
            UserCtl["User Module Controllers"]:::business
            AdminCtl["Admin Module Controllers"]:::business
            TechCtl["Technician Module Controllers"]:::business
        end
        subgraph "Requests/Validation"
            direction TB
            Requests["HTTP Requests & Validation"]:::business
        end
        subgraph "Domain"
            direction TB
            Models["Eloquent Models"]:::data
            Providers["Service Providers & DI"]:::business
            ViewComp["View Components"]:::business
            BladeViews["Blade Views & Layouts"]:::business
        end
    end

    PublicIndex --> Kernel
    Kernel --> Middleware
    Middleware --> Router
    Router --> AuthCtl
    Router --> UserCtl
    Router --> AdminCtl
    Router --> TechCtl
    AuthCtl --> Requests
    UserCtl --> Requests
    AdminCtl --> Requests
    TechCtl --> Requests
    AuthCtl --> Models
    UserCtl --> Models
    AdminCtl --> Models
    TechCtl --> Models
    ControllersJobs["Controllers trigger Jobs"]:::business
    AuthCtl --> ControllersJobs
    UserCtl --> ControllersJobs
    AdminCtl --> ControllersJobs
    TechCtl --> ControllersJobs
    Providers --> AuthCtl
    ViewComp --> BladeViews

    %% Data Layer
    subgraph "Data Layer"
        direction TB
        Database["Database (MySQL/PostgreSQL)"]:::data
        Storage["Storage (Uploads, S3)"]:::data
        CacheQueue["Cache & Session Store (Redis/File)"]:::data
        QueueWorker["Queue Worker"]:::data
        Migrations["DB Migrations & Seeders"]:::data
    end

    Models --> Database
    Models --> Storage
    ControllersJobs --> QueueWorker
    QueueWorker --> Database
    Database --> Migrations
    CacheQueue --> Kernel

    %% External Services
    subgraph "External Services"
        direction TB
        MailService["Mail Service"]:::external
        PaymentAPI["Payment Gateway API"]:::external
    end

    AuthCtl -->|send Notifications| MailService
    UserCtl -->|process Payments| PaymentAPI
    AdminCtl -->|process Payments| PaymentAPI
    TechCtl -->|generate Reports| MailService

    %% Asset Pipeline
    subgraph "Asset Pipeline"
        direction TB
        AssetSrc["JS/CSS Source"]:::asset
        Vite["Vite & Tailwind"]:::asset
        PublicBuild["public/build Assets"]:::asset
    end

    AssetSrc --> Vite
    Vite --> PublicBuild
    PublicBuild --> Browser

    %% Click Events
    click Router "https://github.com/aldydwi/fathcomp/blob/main/routes/web.php"
    click Router "https://github.com/aldydwi/fathcomp/blob/main/routes/auth.php"
    click Router "https://github.com/aldydwi/fathcomp/blob/main/routes/console.php"
    click Middleware "https://github.com/aldydwi/fathcomp/blob/main/app/Http/Middleware/UserMiddleware.php"
    click AuthCtl "https://github.com/aldydwi/fathcomp/blob/main/app/Http/Controllers/Auth/LoginController.php"
    click AuthCtl "https://github.com/aldydwi/fathcomp/blob/main/app/Http/Controllers/Auth/RegisterController.php"
    click UserCtl "https://github.com/aldydwi/fathcomp/blob/main/app/Http/Controllers/User/BookingController.php"
    click UserCtl "https://github.com/aldydwi/fathcomp/blob/main/app/Http/Controllers/User/RiwayatController.php"
    click UserCtl "https://github.com/aldydwi/fathcomp/blob/main/app/Http/Controllers/User/TestimonialUserController.php"
    click UserCtl "https://github.com/aldydwi/fathcomp/blob/main/app/Http/Controllers/User/UserController.php"
    click AdminCtl "https://github.com/aldydwi/fathcomp/blob/main/app/Http/Controllers/admin/AdminController.php"
    click AdminCtl "https://github.com/aldydwi/fathcomp/blob/main/app/Http/Controllers/admin/AdminBookingController.php"
    click AdminCtl "https://github.com/aldydwi/fathcomp/blob/main/app/Http/Controllers/admin/ListServiceController.php"
    click AdminCtl "https://github.com/aldydwi/fathcomp/blob/main/app/Http/Controllers/admin/PaymentController.php"
    click AdminCtl "https://github.com/aldydwi/fathcomp/blob/main/app/Http/Controllers/admin/PaymentTypeController.php"
    click AdminCtl "https://github.com/aldydwi/fathcomp/blob/main/app/Http/Controllers/admin/ServiceCategoryController.php"
    click AdminCtl "https://github.com/aldydwi/fathcomp/blob/main/app/Http/Controllers/admin/TestimonialController.php"
    click AdminCtl "https://github.com/aldydwi/fathcomp/blob/main/app/Http/Controllers/admin/UserAdminController.php"
    click AdminCtl "https://github.com/aldydwi/fathcomp/blob/main/app/Http/Controllers/admin/UserCustomerController.php"
    click AdminCtl "https://github.com/aldydwi/fathcomp/blob/main/app/Http/Controllers/admin/UserTeknisiController.php"
    click TechCtl "https://github.com/aldydwi/fathcomp/blob/main/app/Http/Controllers/teknisi/TeknisiController.php"
    click TechCtl "https://github.com/aldydwi/fathcomp/blob/main/app/Http/Controllers/teknisi/TeknisiBookingController.php"
    click TechCtl "https://github.com/aldydwi/fathcomp/blob/main/app/Http/Controllers/teknisi/ReportController.php"
    click Requests "https://github.com/aldydwi/fathcomp/blob/main/app/Http/Requests/Auth/LoginRequest.php"
    click Requests "https://github.com/aldydwi/fathcomp/blob/main/app/Http/Requests/ProfileUpdateRequest.php"
    click Models "https://github.com/aldydwi/fathcomp/blob/main/app/Models/Booking.php"
    click Models "https://github.com/aldydwi/fathcomp/blob/main/app/Models/BookingImage.php"
    click Models "https://github.com/aldydwi/fathcomp/blob/main/app/Models/ListService.php"
    click Models "https://github.com/aldydwi/fathcomp/blob/main/app/Models/Payment.php"
    click Models "https://github.com/aldydwi/fathcomp/blob/main/app/Models/PaymentType.php"
    click Models "https://github.com/aldydwi/fathcomp/blob/main/app/Models/RekapTeknisi.php"
    click Models "https://github.com/aldydwi/fathcomp/blob/main/app/Models/Role.php"
    click Models "https://github.com/aldydwi/fathcomp/blob/main/app/Models/ServiceCategory.php"
    click Models "https://github.com/aldydwi/fathcomp/blob/main/app/Models/ServiceReport.php"
    click Models "https://github.com/aldydwi/fathcomp/blob/main/app/Models/Testimonial.php"
    click Models "https://github.com/aldydwi/fathcomp/blob/main/app/Models/User.php"
    click Migrations "https://github.com/aldydwi/fathcomp/tree/main/database/migrations"
    click Migrations "https://github.com/aldydwi/fathcomp/blob/main/database/seeders/DatabaseSeeder.php"
    click Migrations "https://github.com/aldydwi/fathcomp/blob/main/database/seeders/RoleSeeder.php"
    click Migrations "https://github.com/aldydwi/fathcomp/blob/main/database/seeders/UserSeeder.php"
    click Providers "https://github.com/aldydwi/fathcomp/blob/main/app/Providers/AppServiceProvider.php"
    click ViewComp "https://github.com/aldydwi/fathcomp/blob/main/app/View/Components/AppLayout.php"
    click ViewComp "https://github.com/aldydwi/fathcomp/blob/main/app/View/Components/GuestLayout.php"
    click BladeViews "https://github.com/aldydwi/fathcomp/tree/main/resources/views/admin"
    click BladeViews "https://github.com/aldydwi/fathcomp/blob/main/resources/views/user/booking.blade.php"
    click BladeViews "https://github.com/aldydwi/fathcomp/blob/main/resources/views/user/riwayat.blade.php"
    click BladeViews "https://github.com/aldydwi/fathcomp/tree/main/resources/views/teknisi"
    click BladeViews "https://github.com/aldydwi/fathcomp/tree/main/resources/views/auth"
    click BladeViews "https://github.com/aldydwi/fathcomp/tree/main/resources/views/profile"
    click BladeViews "https://github.com/aldydwi/fathcomp/tree/main/resources/views/layouts"
    click AssetSrc "https://github.com/aldydwi/fathcomp/blob/main/resources/js/app.js"
    click AssetSrc "https://github.com/aldydwi/fathcomp/blob/main/resources/css/app.css"
    click AssetSrc "https://github.com/aldydwi/fathcomp/blob/main/vite.config.js"
    click AssetSrc "https://github.com/aldydwi/fathcomp/blob/main/tailwind.config.js"
    click PublicBuild "https://github.com/aldydwi/fathcomp/blob/main/public/build/assets/app-*.js"
    click PublicBuild "https://github.com/aldydwi/fathcomp/blob/main/public/build/assets/app-*.css"
    click Storage "https://github.com/aldydwi/fathcomp/tree/main/storage/app/public"
    click CacheQueue "https://github.com/aldydwi/fathcomp/blob/main/config/cache.php"
    click CacheQueue "https://github.com/aldydwi/fathcomp/blob/main/config/session.php"
    click CacheQueue "https://github.com/aldydwi/fathcomp/blob/main/config/queue.php"
    click MailService "https://github.com/aldydwi/fathcomp/blob/main/config/mail.php"
    click PaymentAPI "https://github.com/aldydwi/fathcomp/blob/main/config/services.php"
    click Kernel "https://github.com/aldydwi/fathcomp/blob/main/bootstrap/app.php"

    %% Styles
    classDef web fill:#cfe2ff,stroke:#2980b9,stroke-width:1px;
    classDef business fill:#d5f5e3,stroke:#27ae60,stroke-width:1px;
    classDef data fill:#fcf3cf,stroke:#f1c40f,stroke-width:1px;
    classDef external fill:#ebdef0,stroke:#8e44ad,stroke-width:1px;
    classDef asset fill:#f0f0f0,stroke:#7f8c8d,stroke-width:1px;
```
