# gpa95/eshop architecture

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

- Interactive diagram: https://gitdiagram.com/gpa95/eshop
- Repository: https://github.com/gpa95/eshop

## Overview

##### Project type and purpose
- E-SHOP is a monolithic, Python-based e-commerce application (Grade 12 academic project).
- It provides a command-line interface (CRUD product listing, authentication, cart management, order processing) and persists data in a MySQL database.
- It also supports CSV export and bar-chart visualization of sales via Pandas and Matplotlib.

##### File structure
- Only one source file (EShop.py) at the root. No separate “src” or “modules” directory—everything lives in a single script.
- A project report PDF is included but not part of the runtime system.
- README outlines technical stack (Python 3+, MySQL, Pandas, Matplotlib, mysql-connector).

##### README for additional insights
- The system uses mysql-connector to talk to a MySQL 8.0 server (user, product, order tables).
- All business logic (authentication, product browsing, cart, orders) is implemented in one big function (customer()), with room for future refactoring.
- Visualization is a secondary feature: sales data → Pandas Series → CSV/Matplotlib bar graph.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Presentation Layer
    subgraph "Presentation Layer"
        CLI["User CLI"]:::presentation
    end

    %% Application Layer
    subgraph "Application Layer"
        Auth["Auth Module"]:::app
        Prod["Product Management Module"]:::app
        Cart["Shopping Cart Module"]:::app
        Order["Order Processing Module"]:::app
        Report["Reporting/Visualization Module"]:::app
    end

    %% Database Layer
    subgraph "Database & Persistence"
        DB["MySQL Database"]:::db
    end

    %% External Libraries
    subgraph "External Libraries"
        Connector["mysql-connector"]:::lib
        Pandas["Pandas"]:::lib
        Matplotlib["Matplotlib"]:::lib
    end

    %% Documentation
    Doc["Project Documentation (README.md)"]:::doc

    %% Connections
    CLI -->|invokes| Auth
    CLI -->|invokes| Prod
    CLI -->|invokes| Cart
    CLI -->|invokes| Order
    CLI -->|invokes| Report

    Auth -->|executes SQL via| Connector
    Prod -->|executes SQL via| Connector
    Cart -->|executes SQL via| Connector
    Order -->|executes SQL via| Connector

    Connector -->|connects to TCP 3306| DB

    Report -->|processes data with| Pandas
    Pandas -->|plots with| Matplotlib

    %% Click Events
    click CLI "https://github.com/gpa95/eshop/blob/main/EShop.py"
    click Auth "https://github.com/gpa95/eshop/blob/main/EShop.py"
    click Prod "https://github.com/gpa95/eshop/blob/main/EShop.py"
    click Cart "https://github.com/gpa95/eshop/blob/main/EShop.py"
    click Order "https://github.com/gpa95/eshop/blob/main/EShop.py"
    click Report "https://github.com/gpa95/eshop/blob/main/EShop.py"
    click Connector "https://github.com/gpa95/eshop/blob/main/EShop.py"
    click DB "https://github.com/gpa95/eshop/blob/main/EShop.py"
    click Pandas "https://github.com/gpa95/eshop/blob/main/EShop.py"
    click Matplotlib "https://github.com/gpa95/eshop/blob/main/EShop.py"
    click Doc "https://github.com/gpa95/eshop/blob/main/README.md"

    %% Styles
    classDef presentation fill:#aecbfa,stroke:#333,stroke-width:1px;
    classDef app fill:#c8e6c9,stroke:#333,stroke-width:1px;
    classDef db fill:#ffcc80,stroke:#333,stroke-width:1px;
    classDef lib fill:#d1c4e9,stroke:#333,stroke-width:1px;
    classDef doc fill:#f0f0f0,stroke:#333,stroke-width:1px;
```
