# andrewtch88/mvc-ecommerce architecture

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

- Interactive diagram: https://gitdiagram.com/andrewtch88/mvc-ecommerce
- Repository: https://github.com/andrewtch88/mvc-ecommerce

## Overview

##### Main Components

a) Client Layer:
- Web browser interface
- Static assets (CSS, JS, images) from the /static directory
- Materialize framework integration

b) Frontend Layer:
- PHP View files (*.php in root directory)
- Them by functionality:
- User Authentication (login.php, signup.php)
- Product Management (product.php, product_catalogue.php)
- Admin Interface (admin*.php files)
- Shopping (cart.php, payment.php)

c) Backend Layer:
- Controllers (/includes directory with *.inc.php files)
- Classes (business logic)
- MVC pattern implementation

d) Database Layer:
- MySQL Database (ogtech.sql)
- Key tables for:
- Users
- Products
- Orders
- Reviews

**[Client Layer]**
- ↕
**[Frontend Layer]**
- ↕
**[Backend Layer]**
- ↕
**[Database Layer]**

##### Key Elements to Highlight

a) Data Flow:
- User requests → Frontend → Controller → Class → Database
- Response path back to user
- AJAX interactions for forms

b) Component Relationships:
- How includes/class_autoloader.php connects to classes
- Demonstrate how admin functions interact with product management
- Shopping cart flow from selection to payment

##### Technical Details

- XAMPP server environment
- PHP MVC architecture
- MySQL database
- Materialize CSS framework
- JavaScript functionality (Magnifier, pagination, etc.)

##### Additional Notes

- Notes about authentication flow
- Potential scaling points
- Where future improvements (like Stripe integration) could fit

Remember to indicate the neon theme implementation in the frontend layer, as it's a distinctive feature of this project. Also, note the separation between public user functions and administrative capabilities, as this is a key security consideration.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Client
        Browser["Web Browser"]
        StaticAssets["Static Assets"]:::static
        MaterializeCSS["Materialize Framework"]:::framework
    end

    subgraph Frontend
        direction TB
        AuthViews["Authentication Views"]:::frontend
        ProductViews["Product Views"]:::frontend
        AdminViews["Admin Views"]:::frontend
        ShoppingViews["Shopping Views"]:::frontend
        LayoutViews["Layout Components"]:::frontend
        ExtraViews["Additional Features"]:::frontend
    end

    subgraph Backend
        Controllers["Controllers"]:::backend
        ClassAutoloader["Class Autoloader"]:::backend
        BusinessLogic["Business Logic Classes"]:::backend
    end

    subgraph Database
        MySQL["MySQL Database"]:::database
        Tables["Tables<br/>(Users, Products,<br/>Orders, Reviews)"]:::database
    end

    %% Connections
    Browser --> StaticAssets
    Browser --> MaterializeCSS
    Browser --> Frontend
    Frontend --> Controllers
    Controllers --> BusinessLogic
    BusinessLogic --> MySQL
    ClassAutoloader --> BusinessLogic
    MySQL --- Tables

    %% Component Details
    AuthViews --> |"includes"|LayoutViews
    ProductViews --> |"includes"|LayoutViews
    AdminViews --> |"includes"|LayoutViews
    ShoppingViews --> |"includes"|LayoutViews
    ExtraViews --> |"includes"|LayoutViews

    %% Click Events
    click StaticAssets "https://github.com/andrewtch88/mvc-ecommerce/tree/main/static"
    click AuthViews "https://github.com/andrewtch88/mvc-ecommerce/blob/main/login.php"
    click ProductViews "https://github.com/andrewtch88/mvc-ecommerce/blob/main/product.php"
    click AdminViews "https://github.com/andrewtch88/mvc-ecommerce/blob/main/admin.php"
    click ShoppingViews "https://github.com/andrewtch88/mvc-ecommerce/blob/main/cart.php"
    click Controllers "https://github.com/andrewtch88/mvc-ecommerce/tree/main/includes"
    click ClassAutoloader "https://github.com/andrewtch88/mvc-ecommerce/blob/main/includes/class_autoloader.php"
    click MySQL "https://github.com/andrewtch88/mvc-ecommerce/blob/main/ogtech.sql"
    click LayoutViews "https://github.com/andrewtch88/mvc-ecommerce/blob/main/header.php"
    click ExtraViews "https://github.com/andrewtch88/mvc-ecommerce/blob/main/review.php"

    %% Styling
    classDef frontend fill:#90EE90,stroke:#333,stroke-width:2px
    classDef backend fill:#FFE5B4,stroke:#333,stroke-width:2px
    classDef database fill:#FF9999,stroke:#333,stroke-width:2px
    classDef static fill:#ADD8E6,stroke:#333,stroke-width:2px
    classDef framework fill:#DDA0DD,stroke:#333,stroke-width:2px

    %% Legend
    subgraph Legend
        Frontend["Frontend Component"]:::frontend
        Backend["Backend Component"]:::backend
        DB["Database Component"]:::database
        Static["Static Assets"]:::static
        Framework["Framework"]:::framework
    end
```
