# chihebabiza/php-multi-seller-ecommerce architecture

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

- Interactive diagram: https://gitdiagram.com/chihebabiza/php-multi-seller-ecommerce
- Repository: https://github.com/chihebabiza/php-multi-seller-ecommerce

## Overview

##### Project type and purpose
- This is a monolithic PHP-based multi-vendor marketplace (LAMP stack).
- It offers three “front-ends” in one codebase: the public client storefront, an admin dashboard, and a vendor (seller) panel.
- Core functionality: vendor registration & product management, customer browsing/cart/checkout, order processing, and admin oversight.

##### File structure
- Top-level directories:
- /client → public-facing storefront (browsing, search, cart, checkout).
- /admin → site-wide admin panel (manage users, products, vendor statuses).
- /vendor → (empty or reserved) seller dashboard.
- /config → DB connection & shared functions.
- /inc → reusable view fragments (header, footer, product card, etc.).
- /css, /js, /images → static assets.
- /uploads → product images or file uploads.
- /database → initial SQL dump.
- This is a single-repo monolith using include-based templating rather than a separated front/back-end API.

##### README for additional insights
- LAMP requirements, installation steps, features list (cart, auth, responsive UI).

##### Detailed element capture
- /client (browse, cart, checkout)
- /admin (user/product management)
- /vendor (product upload, order notifications)
- /config & /inc (shared utility & view code)
- Flow of a “Place Order” scenario:
1. Customer HTTP POST → /client/checkout.php
2. PHP validates, writes order rows to MySQL
3. PHP saves invoice/receipt to /uploads or temp
4. PHP invokes payment API & sends confirmation email
5. Customer sees thank you page (/client/thankyou.php)
- Flow of an “Add Product” scenario for Vendor:
1. Vendor HTTP POST → /vendor/product.php
2. Saves product metadata to MySQL & image to /uploads
3. Vendor sees updated product list

## Diagram (Mermaid)

```mermaid
flowchart TD
    direction TB

    Customer["Customer"]:::user
    VendorUser["Vendor"]:::user
    AdminUser["Admin"]:::user

    Customer -->|HTTP GET/POST| WebServer
    VendorUser -->|HTTP GET/POST| WebServer
    AdminUser -->|HTTP GET/POST| WebServer

    subgraph "Web Server (Apache/Nginx)" 
        direction TB
        StaticFiles["Static Files"]:::static
        PHPApp["PHP Application"]:::app
    end

    WebServer["Web Server"]:::server
    WebServer --> StaticFiles
    WebServer --> PHPApp
    WebServer -->|HTTP response| Customer
    WebServer -->|HTTP response| VendorUser
    WebServer -->|HTTP response| AdminUser

    subgraph "PHP Application" 
        direction TB
        subgraph "Client Module" 
            direction TB
            client_index["index.php"]  
            client_shop["shop.php"]
            client_product["product.php"]
            client_cart["cart.php"]
            client_checkout["checkout.php"]
            client_thankyou["thankyou.php"]
            client_login["login.php"]
            client_register["register.php"]
            client_about["about.php"]
            client_contact["contact.php"]
        end
        subgraph "Admin Module" 
            direction TB
            admin_admin["admin.php"]
            admin_users["users.php"]
            admin_product["product.php"]
            admin_announcements["announcements.php"]
            admin_update_status["update_status.php"]
            admin_update_vendor_status["update_vendor_status.php"]
            admin_logout["logout.php"]
        end
        subgraph "Vendor Module" 
            direction TB
            vendor_panel["vendor/"]
        end
        subgraph "Shared (/config & /inc)" 
            direction TB
            connect["connect.php"]
            function["function.php"]
            head["head.php"]
            header["header.php"]
            footer["footer.php"]
            product_card["product_card.php"]
            comments["comments.php"]
            team["team.php"]
            why["why.php"]
        end
    end

    PHPApp -->|SQL queries| MySQL
    PHPApp -->|File I/O| FileStorage
    PHPApp -->|API calls / SMTP| ExternalServices

    MySQL["MySQL Database"]:::db
    FileStorage["File Storage (/uploads)"]:::storage
    ExternalServices["External Services"]:::cloud

    click client_index "https://github.com/chihebabiza/php-multi-seller-ecommerce/blob/main/client/index.php"
    click client_shop "https://github.com/chihebabiza/php-multi-seller-ecommerce/blob/main/client/shop.php"
    click client_product "https://github.com/chihebabiza/php-multi-seller-ecommerce/blob/main/client/product.php"
    click client_cart "https://github.com/chihebabiza/php-multi-seller-ecommerce/blob/main/client/cart.php"
    click client_checkout "https://github.com/chihebabiza/php-multi-seller-ecommerce/blob/main/client/checkout.php"
    click client_thankyou "https://github.com/chihebabiza/php-multi-seller-ecommerce/blob/main/client/thankyou.php"
    click client_login "https://github.com/chihebabiza/php-multi-seller-ecommerce/blob/main/client/login.php"
    click client_register "https://github.com/chihebabiza/php-multi-seller-ecommerce/blob/main/client/register.php"
    click client_about "https://github.com/chihebabiza/php-multi-seller-ecommerce/blob/main/client/about.php"
    click client_contact "https://github.com/chihebabiza/php-multi-seller-ecommerce/blob/main/client/contact.php"

    click admin_admin "https://github.com/chihebabiza/php-multi-seller-ecommerce/blob/main/admin/admin.php"
    click admin_users "https://github.com/chihebabiza/php-multi-seller-ecommerce/blob/main/admin/users.php"
    click admin_product "https://github.com/chihebabiza/php-multi-seller-ecommerce/blob/main/admin/product.php"
    click admin_announcements "https://github.com/chihebabiza/php-multi-seller-ecommerce/blob/main/admin/announcements.php"
    click admin_update_status "https://github.com/chihebabiza/php-multi-seller-ecommerce/blob/main/admin/update_status.php"
    click admin_update_vendor_status "https://github.com/chihebabiza/php-multi-seller-ecommerce/blob/main/admin/update_vendor_status.php"
    click admin_logout "https://github.com/chihebabiza/php-multi-seller-ecommerce/blob/main/admin/logout.php"

    click vendor_panel "https://github.com/chihebabiza/php-multi-seller-ecommerce/tree/main/vendor/"

    click connect "https://github.com/chihebabiza/php-multi-seller-ecommerce/blob/main/config/connect.php"
    click function "https://github.com/chihebabiza/php-multi-seller-ecommerce/blob/main/config/function.php"

    click head "https://github.com/chihebabiza/php-multi-seller-ecommerce/blob/main/inc/head.php"
    click header "https://github.com/chihebabiza/php-multi-seller-ecommerce/blob/main/inc/header.php"
    click footer "https://github.com/chihebabiza/php-multi-seller-ecommerce/blob/main/inc/footer.php"
    click product_card "https://github.com/chihebabiza/php-multi-seller-ecommerce/blob/main/inc/product_card.php"
    click comments "https://github.com/chihebabiza/php-multi-seller-ecommerce/blob/main/inc/comments.php"
    click team "https://github.com/chihebabiza/php-multi-seller-ecommerce/blob/main/inc/team.php"
    click why "https://github.com/chihebabiza/php-multi-seller-ecommerce/blob/main/inc/why.php"

    click style "https://github.com/chihebabiza/php-multi-seller-ecommerce/blob/main/css/style.css"
    click dash "https://github.com/chihebabiza/php-multi-seller-ecommerce/blob/main/css/dash.css"
    click tinycss "https://github.com/chihebabiza/php-multi-seller-ecommerce/blob/main/css/tiny-slider.css"

    click customjs "https://github.com/chihebabiza/php-multi-seller-ecommerce/blob/main/js/custom.js"
    click tinysliderjs "https://github.com/chihebabiza/php-multi-seller-ecommerce/blob/main/js/tiny-slider.js"

    click images "https://github.com/chihebabiza/php-multi-seller-ecommerce/tree/main/images/"
    click uploads "https://github.com/chihebabiza/php-multi-seller-ecommerce/tree/main/uploads/"
    click dbdump "https://github.com/chihebabiza/php-multi-seller-ecommerce/blob/main/database/brico-dz.sql"

    classDef user fill:#f9f,stroke:#333,stroke-width:1px;
    classDef server fill:#eee,stroke:#666,stroke-width:1px;
    classDef static fill:#cff,stroke:#333,stroke-width:1px;
    classDef app fill:#bbf,stroke:#333,stroke-width:1px;
    classDef module fill:#bfb,stroke:#333,stroke-width:1px;
    classDef shared fill:#ffb,stroke:#333,stroke-width:1px;
    classDef db fill:#afa,stroke:#333,stroke-width:1px;
    classDef storage fill:#ddd,stroke:#333,stroke-width:1px;
    classDef cloud fill:#fcf,stroke:#333,stroke-width:1px;
```
