# mj33t/amin_tech architecture

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

- Interactive diagram: https://gitdiagram.com/mj33t/amin_tech
- Repository: https://github.com/mj33t/amin_tech

## Overview

##### Main Components

A. Frontend Layer:
- Blade Views (resources/views/)
- Public Assets (public/)
- JavaScript & CSS (resources/js, resources/css)

B. Application Layer:
- Controllers (app/Http/Controllers/)
- Middleware (app/Http/Middleware/)
- Routes (routes/)

C. Data Layer:
- Models (app/Models/)
- Database Migrations
- File Storage (storage/app/public)

**[Client Browser]**
- ↕
**[Web Server (Apache/Nginx)]**
- ↕
**[Laravel Application]**
- Frontend Layer
- Public Views
- Admin Views
- Assets (JS/CSS/Images)

- Application Layer
- Routes
- Middleware
- Authentication
- Other Security Middleware

- Controllers
- UserController
- ProductController
- ContactController
- AdminController

- Data Layer
- Models
- User
- Product
- Contact

- Database
- MySQL/PostgreSQL

- File Storage
- Product Images

##### Key Flows to Highlight

A. Authentication Flow:
- Login request → Middleware → UserController → User Model → Database
- Authentication middleware protection for admin routes

B. Product Management Flow:
- Product creation/import
- Image storage process
- CSV import functionality

C. Contact Management Flow:
- Contact submission
- Admin contact review process

##### Implementation Notes

- Maintain consistent spacing and alignment
- Annotations for critical processes

## Diagram (Mermaid)

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

    subgraph WebServer["Web Server Layer"]
        Apache["Apache/Nginx Server"]
    end

    subgraph FrontEnd["Frontend Layer"]
        Views["Blade Views"]:::frontend
        Assets["Public Assets"]:::frontend
        JS["JavaScript"]:::frontend
        CSS["CSS"]:::frontend
        ProductImages["Product Images"]:::frontend
    end

    subgraph AppLayer["Application Layer"]
        Routes["Routes"]:::application
        
        subgraph Middleware["Middleware"]
            Auth["Authentication"]:::security
            UserAuth["User Auth"]:::security
        end
        
        subgraph Controllers["Controllers"]
            UserCtrl["User Controller"]:::controller
            ProductCtrl["Product Controller"]:::controller
            ContactCtrl["Contact Controller"]:::controller
            AdminCtrl["Admin Controller"]:::controller
        end
    end

    subgraph DataLayer["Data Layer"]
        subgraph Models["Models"]
            UserModel["User Model"]:::model
            ProductModel["Product Model"]:::model
            ContactModel["Contact Model"]:::model
        end
        
        Database[(Database)]:::database
        Storage["File Storage"]:::storage
    end

    %% Relationships
    Browser --> Apache
    Apache --> Routes
    Routes --> Auth
    Auth --> Controllers
    UserAuth --> Controllers
    
    Controllers --> Models
    Models --> Database
    ProductCtrl --> Storage
    
    Views --> Controllers
    Assets --> Views
    JS --> Views
    CSS --> Views
    ProductImages --> Views

    %% Click Events
    click Views "https://github.com/MJ33T/amin_tech/tree/master/resources/views/"
    click JS "https://github.com/MJ33T/amin_tech/tree/master/resources/js/"
    click CSS "https://github.com/MJ33T/amin_tech/tree/master/resources/css/"
    click Assets "https://github.com/MJ33T/amin_tech/tree/master/public/"
    click ProductImages "https://github.com/MJ33T/amin_tech/tree/master/public/product_detail/images/"
    click Controllers "https://github.com/MJ33T/amin_tech/tree/master/app/Http/Controllers/"
    click UserCtrl "https://github.com/MJ33T/amin_tech/blob/master/app/Http/Controllers/UserController.php"
    click ProductCtrl "https://github.com/MJ33T/amin_tech/blob/master/app/Http/Controllers/ProductController.php"
    click ContactCtrl "https://github.com/MJ33T/amin_tech/blob/master/app/Http/Controllers/ContactController.php"
    click AdminCtrl "https://github.com/MJ33T/amin_tech/blob/master/app/Http/Controllers/AdminController.php"
    click Auth "https://github.com/MJ33T/amin_tech/blob/master/app/Http/Middleware/Authenticate.php"
    click UserAuth "https://github.com/MJ33T/amin_tech/blob/master/app/Http/Middleware/UserAuth.php"
    click Routes "https://github.com/MJ33T/amin_tech/blob/master/routes/web.php"
    click Models "https://github.com/MJ33T/amin_tech/tree/master/app/Models/"
    click UserModel "https://github.com/MJ33T/amin_tech/blob/master/app/Models/User.php"
    click ProductModel "https://github.com/MJ33T/amin_tech/blob/master/app/Models/Product.php"
    click ContactModel "https://github.com/MJ33T/amin_tech/blob/master/app/Models/Contact.php"
    click Storage "https://github.com/MJ33T/amin_tech/tree/master/storage/app/public/"

    %% Styles
    classDef frontend fill:#3498db,stroke:#2980b9,color:white
    classDef application fill:#2ecc71,stroke:#27ae60,color:white
    classDef security fill:#e74c3c,stroke:#c0392b,color:white
    classDef controller fill:#27ae60,stroke:#219a52,color:white
    classDef model fill:#e67e22,stroke:#d35400,color:white
    classDef database fill:#9b59b6,stroke:#8e44ad,color:white
    classDef storage fill:#f1c40f,stroke:#f39c12,color:black

    %% Legend
    subgraph Legend
        Frontend["Frontend Component"]:::frontend
        AppComp["Application Component"]:::application
        SecComp["Security Component"]:::security
        ContComp["Controller Component"]:::controller
        ModComp["Model Component"]:::model
        DBComp["Database Component"]:::database
        StorComp["Storage Component"]:::storage
    end
```
