# vamshidhar-reddy/ecoommerce architecture

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

- Interactive diagram: https://gitdiagram.com/vamshidhar-reddy/ecoommerce
- Repository: https://github.com/vamshidhar-reddy/ecoommerce

## Overview

##### Project type and purpose
- It serves dynamic pages (products listing, cart pages, user login/sign-up, settings) and manages shopping-cart operations via PHP scripts.

##### File structure
Top-level PHP scripts act as both controllers and views:
- index.php, products.php, cart.php, success.php – page endpoints
- login.php, signup.php, settings.php – user pages
- *_submit.php, *_script.php – form-submission handlers (login_submit.php, signup_script.php, settings_script.php)
- cart-add.php, cart-remove.php – business-logic endpoints for cart operations
- common.php – shared configuration (DB connection, session init)
- header.php, footer.php – shared UI fragments
Static assets:
- style.css – site styling
- bootstrap.js – front-end interaction
Other:
- project_problem_statement.pdf – specification (not part of runtime)

##### README
- The README only provides the project name; no architecture details. We infer a classic LAMP-style monolith.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Client Layer
    Browser["Browser"]:::frontend

    %% Infrastructure Layer
    WebServer["Apache/Nginx + PHP-FPM"]:::infrastructure
    Database["MySQL/MariaDB"]:::infrastructure
    StaticAssets["Static Assets\n(style.css, bootstrap.js)"]:::static

    %% Application Layer
    subgraph "Web Server + PHP Runtime" 
        direction TB
        subgraph Authentication_Module
            direction TB
            LoginPage["login.php"]:::frontend
            SignupPage["signup.php"]:::frontend
            LoginSubmit["login_submit.php"]:::frontend
            SignupScript["signup_script.php"]:::frontend
            LogoutScript["logout_script.php"]:::frontend
        end

        subgraph Product_Module
            direction TB
            ProductsPage["products.php"]:::frontend
            CheckAdded["check-if-added.php"]:::frontend
        end

        subgraph Cart_Module
            direction TB
            CartPage["cart.php"]:::frontend
            CartAdd["cart-add.php"]:::frontend
            CartRemove["cart-remove.php"]:::frontend
            SuccessPage["success.php"]:::frontend
        end

        subgraph Settings_Module
            direction TB
            SettingsPage["settings.php"]:::frontend
            SettingsScript["settings_script.php"]:::frontend
        end

        subgraph Shared_Components
            direction TB
            Common["common.php"]:::static
            Header["header.php"]:::static
            Footer["footer.php"]:::static
        end

        MainEntry["index.php"]:::frontend
        Spec["project_problem_statement.pdf"]:::static
    end

    %% Connections
    Browser -->|"HTTP GET /index.php"| WebServer
    WebServer -->|"serves"| MainEntry
    WebServer -->|"serves"| Authentication_Module
    WebServer -->|"serves"| Product_Module
    WebServer -->|"serves"| Cart_Module
    WebServer -->|"serves"| Settings_Module
    Browser -->|"loads CSS/JS"| StaticAssets
    WebServer -->|"static files"| StaticAssets
    WebServer -->|"executes PHP"| StaticAssets

    %% PHP to DB
    Authentication_Module -->|"SQL queries"| Database
    Product_Module -->|"SELECT * FROM products"| Database
    Cart_Module -->|"UPDATE/SELECT cart"| Database
    Settings_Module -->|"UPDATE user settings"| Database
    MainEntry -->|"session & routing"| Common

    %% Include relationships
    MainEntry -->|includes| Common
    Authentication_Module -->|includes| Common
    Product_Module -->|includes| Common
    Cart_Module -->|includes| Common
    Settings_Module -->|includes| Common
    Authentication_Module -->|includes| Header
    Product_Module -->|includes| Header
    Cart_Module -->|includes| Header
    Settings_Module -->|includes| Header
    Authentication_Module -->|includes| Footer
    Product_Module -->|includes| Footer
    Cart_Module -->|includes| Footer
    Settings_Module -->|includes| Footer

    %% Response flows
    WebServer -->|"HTTP Response (HTML)"| Browser

    %% Click Events
    click LoginPage "https://github.com/vamshidhar-reddy/ecoommerce/blob/master/login.php"
    click SignupPage "https://github.com/vamshidhar-reddy/ecoommerce/blob/master/signup.php"
    click LoginSubmit "https://github.com/vamshidhar-reddy/ecoommerce/blob/master/login_submit.php"
    click SignupScript "https://github.com/vamshidhar-reddy/ecoommerce/blob/master/signup_script.php"
    click LogoutScript "https://github.com/vamshidhar-reddy/ecoommerce/blob/master/logout_script.php"
    click ProductsPage "https://github.com/vamshidhar-reddy/ecoommerce/blob/master/products.php"
    click CheckAdded "https://github.com/vamshidhar-reddy/ecoommerce/blob/master/check-if-added.php"
    click CartPage "https://github.com/vamshidhar-reddy/ecoommerce/blob/master/cart.php"
    click CartAdd "https://github.com/vamshidhar-reddy/ecoommerce/blob/master/cart-add.php"
    click CartRemove "https://github.com/vamshidhar-reddy/ecoommerce/blob/master/cart-remove.php"
    click SuccessPage "https://github.com/vamshidhar-reddy/ecoommerce/blob/master/success.php"
    click SettingsPage "https://github.com/vamshidhar-reddy/ecoommerce/blob/master/settings.php"
    click SettingsScript "https://github.com/vamshidhar-reddy/ecoommerce/blob/master/settings_script.php"
    click Common "https://github.com/vamshidhar-reddy/ecoommerce/blob/master/common.php"
    click Header "https://github.com/vamshidhar-reddy/ecoommerce/blob/master/header.php"
    click Footer "https://github.com/vamshidhar-reddy/ecoommerce/blob/master/footer.php"
    click MainEntry "https://github.com/vamshidhar-reddy/ecoommerce/blob/master/index.php"
    click Spec "https://github.com/vamshidhar-reddy/ecoommerce/blob/master/project_problem_statement.pdf"
    click StaticAssets "https://github.com/vamshidhar-reddy/ecoommerce/blob/master/style.css"
    click StaticAssets "https://github.com/vamshidhar-reddy/ecoommerce/blob/master/bootstrap.js"

    %% Styles
    classDef frontend fill:#D0E8FF,stroke:#0275d8,color:#0275d8
    classDef infrastructure fill:#DFF0D8,stroke:#3c763d,color:#3c763d
    classDef static fill:#FCF8E3,stroke:#8a6d3b,color:#8a6d3b
```
