# duychip0909/laravel-mockup architecture

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

- Interactive diagram: https://gitdiagram.com/duychip0909/laravel-mockup
- Repository: https://github.com/duychip0909/laravel-mockup

## Overview

##### Main Components

A. Frontend Layer:
- Blade Views (resources/views)
- Livewire Components
- JavaScript/CSS Assets
- TailwindCSS Integration

B. Application Layer:
- HTTP Controllers
- Livewire Components
- Authentication System
- Middleware Pipeline

C. Data Layer:
- Models (News, Categories, User)
- Database Migrations
- Eloquent ORM

D. Infrastructure Layer:
- Laravel Framework Core
- Cache System
- File Storage
- Queue System

**[Client Layer]**
- ↓
**[Web/API Layer]**
- ↓
**[Application Layer]**
- ↓
**[Data Layer]**

##### Component Relationships

A. Client Interactions:
**Web Browser → HTTP/HTTPS → Laravel Router**
- ↓
- Middleware Stack
- ↓
- Controllers/Livewire

B. Authentication Flow:
**Auth Controllers ↔ Auth Middleware ↔ User Model**

C. News Management:
**NewsController ↔ News Model ↔ Database**
**Categories Controller ↔ Categories Model ↔ Database**

##### Specific Implementation Details

Key components:

a) Frontend Components:
- Blade Templates
- Livewire Components (NewsCategoryForm, NewsCategoryIndex)
- Authentication Views
- Profile Management Views

b) Controllers:
- API Controllers (Category)
- Auth Controllers
- News Controllers
- Profile Controllers

c) Models:
- User
- News
- Categories

d) Services:
- Authentication
- Session Management
- CSRF Protection
- File Storage

##### Additional Elements

Supporting components:

- Configuration Files
- Route Definitions
- Middleware Stack
- Service Providers
- Database Migrations

##### Technical Notes

- Database tables from migrations
- Authentication flow
- Livewire real-time components
- API endpoints separately

##### The database structure and relationships

Keep the abstraction level focused on the main architectural components while showing the specific features of this news management system, particularly the category and news handling functionality.

This will provide a clear understanding of both the Laravel framework's standard architecture and the specific implementation details of this news management application.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Client
        Browser["Web Browser"]:::client
    end

    subgraph Frontend
        Views["Blade Views"]:::frontend
        LW["Livewire Views"]:::frontend
        Assets["Assets (JS/CSS)"]:::frontend
        TW["TailwindCSS"]:::frontend
        
        click Views "https://github.com/duychip0909/laravel-mockup/tree/main/resources/views"
        click LW "https://github.com/duychip0909/laravel-mockup/tree/main/resources/views/livewire"
        click Assets "https://github.com/duychip0909/laravel-mockup/tree/main/resources/css"
        click TW "https://github.com/duychip0909/laravel-mockup/blob/main/tailwind.config.js"
    end

    subgraph Application
        Router["Laravel Router"]:::app
        
        subgraph Controllers
            HC["HTTP Controllers"]:::controller
            AC["Auth Controllers"]:::controller
            APIC["API Controllers"]:::controller
            NC["News Controller"]:::controller
            CC["Categories Controller"]:::controller
            
            click HC "https://github.com/duychip0909/laravel-mockup/tree/main/app/Http/Controllers"
            click AC "https://github.com/duychip0909/laravel-mockup/tree/main/app/Http/Controllers/Auth"
            click APIC "https://github.com/duychip0909/laravel-mockup/tree/main/app/Http/Controllers/API"
            click NC "https://github.com/duychip0909/laravel-mockup/blob/main/app/Http/Controllers/NewsController.php"
            click CC "https://github.com/duychip0909/laravel-mockup/blob/main/app/Http/Controllers/CategoriesController.php"
        end
        
        subgraph Middleware
            MW["Middleware Stack"]:::middleware
            AuthMW["Auth Middleware"]:::middleware
            
            click MW "https://github.com/duychip0909/laravel-mockup/tree/main/app/Http/Middleware"
        end
        
        subgraph LivewireComponents
            NCF["News Category Form"]:::livewire
            NCI["News Category Index"]:::livewire
            
            click NCF "https://github.com/duychip0909/laravel-mockup/blob/main/app/Http/Livewire/NewsCategoryForm.php"
            click NCI "https://github.com/duychip0909/laravel-mockup/blob/main/app/Http/Livewire/NewsCategoryIndex.php"
        end
    end

    subgraph Data
        subgraph Models
            UM["User Model"]:::model
            NM["News Model"]:::model
            CM["Categories Model"]:::model
            
            click UM "https://github.com/duychip0909/laravel-mockup/blob/main/app/Models/User.php"
            click NM "https://github.com/duychip0909/laravel-mockup/blob/main/app/Models/News.php"
            click CM "https://github.com/duychip0909/laravel-mockup/blob/main/app/Models/Categories.php"
        end
        
        subgraph Database
            Users[("Users Table")]:::db
            News[("News Table")]:::db
            Categories[("Categories Table")]:::db
            
            click Users "https://github.com/duychip0909/laravel-mockup/blob/main/database/migrations/2014_10_12_000000_create_users_table.php"
            click News "https://github.com/duychip0909/laravel-mockup/blob/main/database/migrations/2023_04_18_164304_create_news_table.php"
            click Categories "https://github.com/duychip0909/laravel-mockup/blob/main/database/migrations/2023_04_18_164303_create_categories_table.php"
        end
    end

    subgraph Infrastructure
        Cache["Cache System"]:::infra
        Storage["File Storage"]:::infra
        Queue["Queue System"]:::infra
        Auth["Authentication"]:::infra
        
        click Cache "https://github.com/duychip0909/laravel-mockup/blob/main/config/cache.php"
        click Storage "https://github.com/duychip0909/laravel-mockup/blob/main/config/filesystems.php"
        click Queue "https://github.com/duychip0909/laravel-mockup/blob/main/config/queue.php"
        click Auth "https://github.com/duychip0909/laravel-mockup/blob/main/config/auth.php"
    end

    %% Relationships
    Browser --> Router
    Router --> MW
    MW --> HC & AC & APIC
    HC --> NC & CC
    NC --> NM
    CC --> CM
    AuthMW --> UM
    NCF & NCI --> CM
    NM --> News
    CM --> Categories
    UM --> Users

    %% Styles
    classDef client fill:#E1E1E1,stroke:#333,stroke-width:2px
    classDef frontend fill:#B3E0FF,stroke:#333,stroke-width:1px
    classDef app fill:#98FB98,stroke:#333,stroke-width:1px
    classDef controller fill:#90EE90,stroke:#333,stroke-width:1px
    classDef middleware fill:#98FB98,stroke:#333,stroke-width:1px
    classDef livewire fill:#90EE90,stroke:#333,stroke-width:1px
    classDef model fill:#FFB366,stroke:#333,stroke-width:1px
    classDef db fill:#FFA500,stroke:#333,stroke-width:1px
    classDef infra fill:#D3D3D3,stroke:#333,stroke-width:1px
```
