# fourthyearuni/taskifyv2 architecture

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

- Interactive diagram: https://gitdiagram.com/fourthyearuni/taskifyv2
- Repository: https://github.com/fourthyearuni/taskifyv2

## Overview

##### Project type and purpose
- This is a full-stack task management application (“Taskify v2.0”) comprising:
- A Laravel-based REST API (apps/api)
- A React+Redux single-page app (apps/ui)
- A MySQL database
- Docker containers orchestrated via docker-compose

##### File structure
- Top-level:
- apps/api → Laravel service
- apps/ui → React service
- compose.yml → docker-compose file (defines services: api, ui, db)
- apps/api:
- app/Http/Controllers → REST endpoints (Users, Tasks, Projects, ACL)
- app/Models → Eloquent models & relationships (User, Task, Project, ACL, pivot)
- config/, bootstrap/, routes/ → Laravel config, startup, API routes
- Dockerfile → container build
- apps/ui:
- src/ → React code (components, redux slices, routes, API helpers)
- Dockerfile + nginx.conf → build & serve static assets via Nginx

##### README for additional insights
- Backend:
- Sanctum for authentication (login → token in headers)
- Custom Watchdog middleware for ACL checks
- Eloquent relationships & autopopulation via joins
- UI:
- Redux Toolkit + async thunks for state & API calls
- ProtectedRoute wrapper for client-side auth enforcement
- Deployment:
- Both services run in Docker
- UI served via Nginx, API via PHP server, DB as external volume

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Docker Compose Orchestration"
        direction TB
        Compose["Docker Compose"]:::container
    end

    subgraph "UI Service Container"
        direction TB
        UI_Docker["UI Dockerfile"]:::config
        Nginx["Nginx Server"]:::container
        ReactSPA["React SPA"]:::container
        HTML["Static HTML Template"]:::code
        Entry["SPA Entry (main.tsx)"]:::code
        ReduxStore["Redux Store"]:::module
        Slices["Redux Slices"]:::module
        APIHelpers["API Helpers & Thunks"]:::module
        ProtectedRoute["ProtectedRoute"]:::module
        Routes["App Routes"]:::module
        Views["Auth/Project/Task Views"]:::module
    end

    subgraph "API Service Container"
        direction TB
        API_Docker["API Dockerfile"]:::config
        Sanctum["Sanctum Config"]:::config
        Watchdog["Watchdog Middleware"]:::module
        subgraph "Laravel Routes"
            direction TB
            APIRoutes["API Routes"]:::code
            WebRoutes["Web Routes"]:::code
        end
        subgraph "Controllers"
            direction TB
            UserCtrl["UserController"]:::module
            TaskCtrl["TasksController"]:::module
            ProjectCtrl["ProjectsController"]:::module
            ACLCtrl["AccessControlListController"]:::module
            AssocCtrl["AclUserAssocController"]:::module
        end
        subgraph "Models & Migrations"
            direction TB
            UserModel["User Model"]:::module
            TaskModel["Task Model"]:::module
            ProjectModel["Project Model"]:::module
            ACLModel["ACL Model"]:::module
            PivotModel["AclUserAssoc Model"]:::module
            Migrations["DB Migrations"]:::code
        end
    end

    subgraph "Database"
        direction TB
        MySQL["MySQL Database"]:::db
    end

    %% Connections
    Compose --> UI_Docker
    Compose --> API_Docker
    Compose --> MySQL

    Browser["Client Browser"]:::external
    Browser -->|HTTP GET| Nginx
    Nginx -->|serves JS| ReactSPA
    ReactSPA -->|loads| HTML
    ReactSPA -->|initializes| Entry
    Entry -->|configures| ReduxStore
    ReduxStore -->|uses| Slices
    ReduxStore -->|dispatches| APIHelpers
    ReactSPA -->|renders| ProtectedRoute
    ReactSPA -->|routes via| Routes
    Routes -->|renders| Views
    APIHelpers -->|REST calls| APIRoutes
    APIRoutes -->|sanctum auth| Sanctum
    APIRoutes -->|passes through| Watchdog
    Watchdog --> Controllers
    Controllers --> Models
    Models -->|queries| MySQL
    Migrations -->|setup| MySQL

    %% Click Events
    click Compose "https://github.com/fourthyearuni/taskifyv2/blob/main/compose.yml"
    click UI_Docker "https://github.com/fourthyearuni/taskifyv2/tree/main/apps/ui/Dockerfile"
    click Nginx "https://github.com/fourthyearuni/taskifyv2/blob/main/apps/ui/nginx.conf"
    click HTML "https://github.com/fourthyearuni/taskifyv2/blob/main/apps/ui/index.html"
    click Entry "https://github.com/fourthyearuni/taskifyv2/blob/main/apps/ui/src/main.tsx"
    click ReduxStore "https://github.com/fourthyearuni/taskifyv2/blob/main/apps/ui/src/redux/store.ts"
    click Slices "https://github.com/fourthyearuni/taskifyv2/blob/main/apps/ui/src/redux/slices/project.ts"
    click Slices "https://github.com/fourthyearuni/taskifyv2/blob/main/apps/ui/src/redux/slices/task.ts"
    click Slices "https://github.com/fourthyearuni/taskifyv2/blob/main/apps/ui/src/redux/slices/user.ts"
    click APIHelpers "https://github.com/fourthyearuni/taskifyv2/blob/main/apps/ui/src/api/users.ts"
    click APIHelpers "https://github.com/fourthyearuni/taskifyv2/blob/main/apps/ui/src/api/tasks.ts"
    click APIHelpers "https://github.com/fourthyearuni/taskifyv2/blob/main/apps/ui/src/api/projects.ts"
    click APIHelpers "https://github.com/fourthyearuni/taskifyv2/blob/main/apps/ui/src/helpers/fetch.ts"
    click APIHelpers "https://github.com/fourthyearuni/taskifyv2/blob/main/apps/ui/src/helpers/thunks.ts"
    click ProtectedRoute "https://github.com/fourthyearuni/taskifyv2/blob/main/apps/ui/src/components/ProtectedRoute.tsx"
    click Routes "https://github.com/fourthyearuni/taskifyv2/blob/main/apps/ui/src/routes/auth.tsx"
    click Views "https://github.com/fourthyearuni/taskifyv2/blob/main/apps/ui/src/views/auth/login.tsx"
    click Views "https://github.com/fourthyearuni/taskifyv2/blob/main/apps/ui/src/views/auth/signup.tsx"
    click Views "https://github.com/fourthyearuni/taskifyv2/blob/main/apps/ui/src/views/projects/Projects.List.tsx"
    click Views "https://github.com/fourthyearuni/taskifyv2/blob/main/apps/ui/src/views/projects/Projects.Add.tsx"
    click Views "https://github.com/fourthyearuni/taskifyv2/blob/main/apps/ui/src/views/projects/Projects.Edit.tsx"
    click Views "https://github.com/fourthyearuni/taskifyv2/blob/main/apps/ui/src/views/projects/Projects.Single.tsx"
    click Views "https://github.com/fourthyearuni/taskifyv2/blob/main/apps/ui/src/views/tasks/Tasks.List.tsx"
    click Views "https://github.com/fourthyearuni/taskifyv2/blob/main/apps/ui/src/views/tasks/Tasks.Add.tsx"
    click Views "https://github.com/fourthyearuni/taskifyv2/blob/main/apps/ui/src/views/tasks/Tasks.Edit.tsx"
    click Views "https://github.com/fourthyearuni/taskifyv2/blob/main/apps/ui/src/views/tasks/Tasks.Single.tsx"
    click API_Docker "https://github.com/fourthyearuni/taskifyv2/tree/main/apps/api/Dockerfile"
    click Sanctum "https://github.com/fourthyearuni/taskifyv2/blob/main/apps/api/config/sanctum.php"
    click APIRoutes "https://github.com/fourthyearuni/taskifyv2/blob/main/apps/api/routes/api.php"
    click WebRoutes "https://github.com/fourthyearuni/taskifyv2/blob/main/apps/api/routes/web.php"
    click UserCtrl "https://github.com/fourthyearuni/taskifyv2/blob/main/apps/api/app/Http/Controllers/UserController.php"
    click TaskCtrl "https://github.com/fourthyearuni/taskifyv2/blob/main/apps/api/app/Http/Controllers/TasksController.php"
    click ProjectCtrl "https://github.com/fourthyearuni/taskifyv2/blob/main/apps/api/app/Http/Controllers/ProjectsController.php"
    click ACLCtrl "https://github.com/fourthyearuni/taskifyv2/blob/main/apps/api/app/Http/Controllers/AccessControlListController.php"
    click AssocCtrl "https://github.com/fourthyearuni/taskifyv2/blob/main/apps/api/app/Http/Controllers/AclUserAssocController.php"
    click Watchdog "https://github.com/fourthyearuni/taskifyv2/blob/main/apps/api/app/Http/Middleware/Watchdog.php"
    click UserModel "https://github.com/fourthyearuni/taskifyv2/blob/main/apps/api/app/Models/User.php"
    click TaskModel "https://github.com/fourthyearuni/taskifyv2/blob/main/apps/api/app/Models/Task.php"
    click ProjectModel "https://github.com/fourthyearuni/taskifyv2/blob/main/apps/api/app/Models/projects.php"
    click ACLModel "https://github.com/fourthyearuni/taskifyv2/blob/main/apps/api/app/Models/acl.php"
    click PivotModel "https://github.com/fourthyearuni/taskifyv2/blob/main/apps/api/app/Models/acl_user_assoc.php"
    click Migrations "https://github.com/fourthyearuni/taskifyv2/blob/main/apps/api/database/migrations/*.php"
    click MySQL "https://github.com/fourthyearuni/taskifyv2/blob/main/compose.yml"

    %% Styles
    classDef container fill:#f2f7ff,stroke:#0366d6,stroke-width:2px
    classDef module fill:#e8f0fe,stroke:#1a73e8
    classDef db fill:#e6f4ea,stroke:#34a853
    classDef config fill:#fce8e6,stroke:#ea4335
    classDef code fill:#fff4e5,stroke:#fbbc04
    classDef external fill:#f0f0f0,stroke:#999999,stroke-dasharray: 5 5
    class Browser external
```
