# andresrubiot/task architecture

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

- Interactive diagram: https://gitdiagram.com/andresrubiot/task
- Repository: https://github.com/andresrubiot/task

## Overview

##### Project Type & Purpose
- This is a full-stack Laravel web application implementing an MVC pattern with RESTful APIs for user authentication and task management.
- Key features: user registration/login (AuthController), CRUD operations on “tasks” (TaskController), request validation, Eloquent ORM for persistence, and Jetstream/Sanctum or JWT for token-based auth.

##### High-Level File Structure Analysis
- app/Http/Controllers: MVC controllers (AuthController, TaskController)
- app/Models: Eloquent models (User, Task)
- app/Http/Requests: form/request validation classes
- routes/web.php & routes/api.php: HTTP routing split for browser views vs. JSON API
- resources/views: Blade templates for server-rendered UI
- resources/js & resources/css: front-end assets bundled via Vite
- config/: framework & service configurations (database, JWT, Sanctum, cache, mail, queue)
- database/migrations & factories: schema & seeders
- storage/: file uploads, logs, cache, sessions

a. Clients
- Browser / SPA (front-end assets loaded via public/index.php)
- (Optional) Mobile/native client consuming the API
b. Presentation Layer
- public/index.php ➔ Laravel HTTP Kernel
- Middleware stack (Authenticate, CSRF, etc.)
- Router ➔ dispatch to Controllers (web vs. api)
c. Application Layer
- Controllers handle inbound requests
- Form Request validation classes
- Business logic can be factored into Services (if present)
d. Persistence Layer
- Eloquent ORM models (User, Task)
- Underlying database (MySQL/PostgreSQL/SQLite per config/database.php)
- Cache store (Redis/file)
e. Supporting Services
- Queue system (jobs processed by app/Console/Kernel)
- Mail (config/mail)
- Filesystem (local/public, S3 via config/filesystems)
- Broadcasting (Pusher/WebSockets)
- External auth (OAuth providers via config/services)
f. Build & Deployment
- Vite for JS/CSS bundling (vite.config.js)
- Composer for PHP dependencies
- Environment config (.env, .env.testing)
- CI pipelines (phpunit.xml)

##### Relationships & Data Flows
- User ➔ Browser/UI ➔ HTTP Request ➔ public/index.php ➔ Kernel ➔ Middleware ➔ Router ➔ Controller ➔ Model ➔ Database
- Controller ➔ dispatch Jobs ➔ Queue Worker ➔ Job Handler
- Controller ➔ send Mail/Notifications ➔ Mail Service
- Static assets served from public/ via web server (Nginx/Apache)
- Vite dev server (during development) ➔ hot-reload of JS/CSS

##### Architectural Patterns & Principles
- MVC (Models, Views, Controllers)
- RESTful API design (routes/api.php)
- Dependency Injection via Laravel IoC container (Service Providers in app/Providers)
- Layered architecture: Presentation / Application / Persistence
- Single Responsibility: Form Requests, Controllers, Models separated
- Event-driven (app/Providers/EventServiceProvider) & job queues

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Clients
    subgraph "Clients" 
        direction TB
        Browser["Browser / SPA"]:::frontend
    end

    %% Presentation Layer
    subgraph "Presentation Layer"
        direction TB
        Index["public/index.php"]:::backend
        Kernel["HTTP Kernel"]:::backend
        Middleware["Middleware Stack"]:::backend
        RouterWeb["Router (web.php)"]:::backend
        RouterAPI["Router (api.php)"]:::backend
    end

    %% Application Layer
    subgraph "Application Layer"
        direction TB
        Controllers["Controllers"]:::backend
        AuthC["AuthController"]:::backend
        TaskC["TaskController"]:::backend
        BaseC["Base Controller"]:::backend
        FormReq["Form Request Validation"]:::backend
        LoginR["LoginRequest"]:::backend
        RegR["RegisterRequest"]:::backend
        TaskR["TaskRequest"]:::backend
        ServiceProv["Service Providers"]:::backend
    end

    %% Persistence Layer
    subgraph "Persistence Layer"
        direction TB
        Models["Eloquent Models"]:::backend
        UserM["User"]:::backend
        TaskM["Task"]:::backend
        Database[(Database)]:::persistence
        Cache[(Cache)]:::storage
    end

    %% Supporting Services
    subgraph "Supporting Services"
        direction TB
        Queue["Queue System"]:::storage
        Mail["Mail Service"]:::external
        Filesystem["Filesystem"]:::external
        Broadcasting["Broadcasting"]:::external
        OAuth["External Auth"]:::external
    end

    %% Build & Deployment
    subgraph "Build & Deployment"
        direction TB
        Vite["Vite (JS/CSS)"]:::frontend
        Composer["Composer"]:::backend
        Env["Env Configs"]:::backend
        CI["CI / PHPUnit"]:::backend
    end

    %% Connections
    Browser -->|"HTTP Request"| Index
    Index --> Kernel
    Kernel --> Middleware
    Middleware --> RouterWeb
    Middleware --> RouterAPI
    RouterWeb --> AuthC
    RouterWeb --> TaskC
    RouterAPI --> AuthC
    RouterAPI --> TaskC
    AuthC -->|uses| FormReq
    TaskC -->|uses| FormReq
    AuthC -->|extends| BaseC
    TaskC -->|extends| BaseC
    FormReq --> LoginR
    FormReq --> RegR
    FormReq --> TaskR
    AuthC -->|calls| UserM
    TaskC -->|calls| TaskM
    UserM --> Database
    TaskM --> Database
    AuthC -->|caches| Cache
    TaskC -->|caches| Cache
    AuthC -->|dispatches| Queue
    TaskC -->|dispatches| Queue
    Queue -->|processed by| Queue
    AuthC -->|sends mail via| Mail
    TaskC -->|stores files via| Filesystem
    TaskC -->|broadcasts via| Broadcasting
    AuthC -->|oauth via| OAuth
    Vite --> Browser
    Composer --> Index
    Env --> Index
    CI --> Index

    %% Click Events
    click Browser "https://github.com/andresrubiot/task/blob/main/public/index.php"
    click Index "https://github.com/andresrubiot/task/blob/main/public/index.php"
    click Kernel "https://github.com/andresrubiot/task/blob/main/app/Http/Kernel.php"
    click Middleware "https://github.com/andresrubiot/task/tree/main/app/Http/Middleware/"
    click RouterWeb "https://github.com/andresrubiot/task/blob/main/routes/web.php"
    click RouterAPI "https://github.com/andresrubiot/task/blob/main/routes/api.php"
    click AuthC "https://github.com/andresrubiot/task/blob/main/app/Http/Controllers/AuthController.php"
    click TaskC "https://github.com/andresrubiot/task/blob/main/app/Http/Controllers/TaskController.php"
    click BaseC "https://github.com/andresrubiot/task/blob/main/app/Http/Controllers/Controller.php"
    click LoginR "https://github.com/andresrubiot/task/blob/main/app/Http/Requests/LoginRequest.php"
    click RegR "https://github.com/andresrubiot/task/blob/main/app/Http/Requests/RegisterRequest.php"
    click TaskR "https://github.com/andresrubiot/task/blob/main/app/Http/Requests/TaskRequest.php"
    click UserM "https://github.com/andresrubiot/task/blob/main/app/Models/User.php"
    click TaskM "https://github.com/andresrubiot/task/blob/main/app/Models/Task.php"
    click Queue "https://github.com/andresrubiot/task/blob/main/app/Console/Kernel.php"
    click Mail "https://github.com/andresrubiot/task/blob/main/config/mail.php"
    click Filesystem "https://github.com/andresrubiot/task/blob/main/config/filesystems.php"
    click Broadcasting "https://github.com/andresrubiot/task/blob/main/config/broadcasting.php"
    click OAuth "https://github.com/andresrubiot/task/blob/main/config/services.php"
    click Vite "https://github.com/andresrubiot/task/blob/main/vite.config.js"
    click Composer "https://github.com/andresrubiot/task/blob/main/composer.json"
    click Env "https://github.com/andresrubiot/task/blob/main/ .env.example"
    click CI "https://github.com/andresrubiot/task/blob/main/phpunit.xml"

    %% Styles
    classDef frontend fill:#BBDEFB,stroke:#0D47A1,color:#0D47A1;
    classDef backend fill:#C8E6C9,stroke:#1B5E20,color:#1B5E20;
    classDef persistence fill:#FFE0B2,stroke:#E65100,color:#E65100;
    classDef storage fill:#CFD8DC,stroke:#37474F,color:#37474F;
    classDef external fill:#F8BBD0,stroke:#880E4F,color:#880E4F;
```
