# plout-hu/shopping architecture

> Architecture diagram of the GitHub repository plout-hu/shopping, 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/plout-hu/shopping
- Repository: https://github.com/plout-hu/shopping

## Overview

##### Main Components

Frontend Layer:
- Vue.js Application (ShoppingPages/shopping)
- Key Views:
- Login/Registration
- Shopping Cart
- Product Listing
- Order History
- Admin Dashboard
- Element UI Components

Backend Layer:
- Spring Boot Application
- Controllers Layer
- Service Layer
- Data Access Layer (Mappers)
- Security/Authentication Layer

Database Layer:
- MySQL Database (indicated by SQL/initDatabase.sql)
- Key Tables:
- Customers
- Goods
- Orders
- Shopping Cart
- Verification Codes

##### Architecture Pattern
The system follows a classic 3-tier architecture with additional cross-cutting concerns. Here's how to represent it:

**Client Layer (Top)**
- Vue.js Frontend (Port 90)
- Views
- Router

**API Layer (Middle)**
- Spring Boot Backend
- Controllers
- Services
- Mappers

**Data Layer (Bottom)**
- MySQL Database

**Cross-Cutting Concerns (Side)**
- Authentication (JWT)
- Exception Handling
- Email Service

##### Key Relationships to Highlight

- JWT token flow for authentication
- Data flow from Controllers → Services → Mappers → Database
- Email verification system flow

##### Technical Details

Frontend:
- Vue.js with Element UI
- Vue Router for navigation
- Port 90 for frontend service

Backend:
- Spring Boot 3.1.1
- MyBatis for data access
- JWT for authentication
- Email service integration

##### Additional Notes

- Database table relationships
- MVC pattern within the backend structure

- How authentication flows through the system
- How shopping cart operations are processed
- How orders are created and managed
- How admin functions are separated from regular user functions
- How the email verification system integrates with the main application

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Frontend
        VueApp["Vue.js Application (Port 90)"]:::frontend
        click VueApp "https://github.com/Plout-hu/Shopping/tree/master/ShoppingPages/shopping/"
        
        subgraph Views
            LoginView["Login/Registration View"]:::frontend
            click LoginView "https://github.com/Plout-hu/Shopping/blob/master/ShoppingPages/shopping/src/views/LoginView.vue"
            CartView["Shopping Cart View"]:::frontend
            click CartView "https://github.com/Plout-hu/Shopping/blob/master/ShoppingPages/shopping/src/views/ShoppingCartView.vue"
            ProductView["Product Listing View"]:::frontend
            click ProductView "https://github.com/Plout-hu/Shopping/blob/master/ShoppingPages/shopping/src/views/GoodsView.vue"
            OrderView["Order History View"]:::frontend
            click OrderView "https://github.com/Plout-hu/Shopping/blob/master/ShoppingPages/shopping/src/views/OrderHistoryView.vue"
            DashboardView["Customer Dashboard"]:::frontend
            click DashboardView "https://github.com/Plout-hu/Shopping/blob/master/ShoppingPages/shopping/src/views/CustomerView.vue"
        end
    end

    subgraph Backend
        subgraph Controllers
            CustCtrl["Customer Controller"]:::controller
            click CustCtrl "https://github.com/Plout-hu/Shopping/blob/master/src/main/java/com/study/shopping/controller/CustomerController.java"
            GoodsCtrl["Goods Controller"]:::controller
            click GoodsCtrl "https://github.com/Plout-hu/Shopping/blob/master/src/main/java/com/study/shopping/controller/GoodsController.java"
            LoginCtrl["Login Controller"]:::controller
            click LoginCtrl "https://github.com/Plout-hu/Shopping/blob/master/src/main/java/com/study/shopping/controller/LoginController.java"
            OrderCtrl["Order Controller"]:::controller
            click OrderCtrl "https://github.com/Plout-hu/Shopping/blob/master/src/main/java/com/study/shopping/controller/OrderHistoryController.java"
            CartCtrl["Shopping Cart Controller"]:::controller
            click CartCtrl "https://github.com/Plout-hu/Shopping/blob/master/src/main/java/com/study/shopping/controller/ShoppingCartController.java"
        end

        subgraph Services
            CustSvc["Customer Service"]:::service
            click CustSvc "https://github.com/Plout-hu/Shopping/blob/master/src/main/java/com/study/shopping/service/CustomerService.java"
            GoodsSvc["Goods Service"]:::service
            click GoodsSvc "https://github.com/Plout-hu/Shopping/blob/master/src/main/java/com/study/shopping/service/GoodsService.java"
            OrderSvc["Order Service"]:::service
            click OrderSvc "https://github.com/Plout-hu/Shopping/blob/master/src/main/java/com/study/shopping/service/OrderService.java"
            CartSvc["Shopping Cart Service"]:::service
            click CartSvc "https://github.com/Plout-hu/Shopping/blob/master/src/main/java/com/study/shopping/service/ShoppingCartService.java"
            EmailSvc["Email Service"]:::service
            click EmailSvc "https://github.com/Plout-hu/Shopping/blob/master/src/main/java/com/study/shopping/service/MailSendService.java"
        end

        subgraph DataAccess
            CustMap["Customer Mapper"]:::mapper
            click CustMap "https://github.com/Plout-hu/Shopping/blob/master/src/main/java/com/study/shopping/mapper/CustomerMapper.java"
            GoodsMap["Goods Mapper"]:::mapper
            click GoodsMap "https://github.com/Plout-hu/Shopping/blob/master/src/main/java/com/study/shopping/mapper/GoodsMapper.java"
            OrderMap["Order Mapper"]:::mapper
            click OrderMap "https://github.com/Plout-hu/Shopping/blob/master/src/main/java/com/study/shopping/mapper/OrderMapper.java"
            CartMap["Shopping Cart Mapper"]:::mapper
            click CartMap "https://github.com/Plout-hu/Shopping/blob/master/src/main/java/com/study/shopping/mapper/ShoppingCartMapper.java"
        end
    end

    subgraph Security
        JWT["JWT Utils"]:::security
        click JWT "https://github.com/Plout-hu/Shopping/blob/master/src/main/java/com/study/shopping/utils/JwtUtils.java"
        Interceptor["Login Interceptor"]:::security
        click Interceptor "https://github.com/Plout-hu/Shopping/blob/master/src/main/java/com/study/shopping/interceptor/LoginCheckInterceptor.java"
        ExHandler["Exception Handler"]:::security
        click ExHandler "https://github.com/Plout-hu/Shopping/blob/master/src/main/java/com/study/shopping/exception/GlobalExceptionHandler.java"
    end

    subgraph Database
        MySQL[(MySQL Database)]:::database
        click MySQL "https://github.com/Plout-hu/Shopping/blob/master/SQL/initDatabase.sql"
    end

    %% Connections
    VueApp --> Controllers
    Controllers <--> Services
    Services <--> DataAccess
    DataAccess <--> MySQL
    Controllers <--> JWT
    JWT <--> Interceptor
    Services --> EmailSvc
    Controllers --> ExHandler

    %% Styles
    classDef frontend fill:#3498db,stroke:#2980b9,color:white
    classDef controller fill:#2ecc71,stroke:#27ae60,color:white
    classDef service fill:#27ae60,stroke:#219a52,color:white
    classDef mapper fill:#16a085,stroke:#0e6655,color:white
    classDef security fill:#e74c3c,stroke:#c0392b,color:white
    classDef database fill:#f1c40f,stroke:#f39c12,color:black

    %% Legend
    subgraph Legend
        Frontend_["Frontend"]:::frontend
        Backend_["Backend"]:::controller
        Security_["Security"]:::security
        Database_["Database"]:::database
    end
```
