# ongcaoboi/proxtech-shop architecture

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

- Interactive diagram: https://gitdiagram.com/ongcaoboi/proxtech-shop
- Repository: https://github.com/ongcaoboi/proxtech-shop

## Overview

##### Main Architecture Components

a) Client Layer (Top)
- Web Browser (Rectangle)
- REST Clients (Rectangle)

b) Security Layer (Below Client Layer)
- Spring Security Filter Chain (Hexagon)
- Authentication/Authorization components

c) Gateway/Controller Layer (Multiple Rectangles)
- Admin Controllers Package
- API Rest Controllers Package
- Main Controllers Package

d) Service Layer (Rounded Rectangles)
- Product Service
- Order Service
- User Service
- Cart Service
- Payment Service
- etc.

e) Repository Layer (Database Symbols)
- JPA Repositories
- Custom Repositories

- Entity Tables

##### Component Relationships

a) Data Flow
- Client → Security → Controllers → Services → Repositories → Database
- Response flow in reverse direction

b) Dependencies
- Service-to-Service communications
- Bean dependencies
- Entity relationships

##### Special Components

Create special sections for:

a) Global Beans (Hexagon)
- UserLogin Bean
- Brand Bean
- Category Bean
- Other global components

b) View Templates (Document Symbols)
- Thymeleaf templates
- Static resources

##### Key Technical Elements

Components:

a) Spring Framework Components
- Spring Boot
- Spring Security
- Spring Data JPA
- Thymeleaf

b) Model Components
- Entities
- DTOs/ViewModels
- Request/Response objects

##### Specific Implementation Details

Elements:

a) Authentication Flow
- Security filter chain
- User authentication process

b) Business Logic Flow
- Product management
- Order processing
- Cart handling
- Payment processing

##### Additional Notes

Annotations:
- File upload paths
- Static resource locations
- Configuration properties
- Bean scope indicators

##### The separation of admin and customer functionalities

Remember to maintain a balance between detail and clarity, focusing on the architectural relationships while avoiding overwhelming technical minutiae.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Style Definitions
    classDef client fill:#a8d1f0,stroke:#000
    classDef security fill:#90EE90,stroke:#000
    classDef controller fill:#FFEB3B,stroke:#000
    classDef service fill:#FFA726,stroke:#000
    classDef repository fill:#CE93D8,stroke:#000
    classDef database fill:#90A4AE,stroke:#000
    classDef bean fill:#FF7043,stroke:#000
    classDef view fill:#81C784,stroke:#000
    classDef model fill:#64B5F6,stroke:#000

    %% Client Layer
    subgraph ClientLayer
        Browser["Web Browser"]:::client
        RestClients["REST Clients"]:::client
    end

    %% Security Layer
    subgraph SecurityLayer
        SecurityFilter["Spring Security Filter Chain"]:::security
        AuthConfig["Security Config"]:::security
        FailureHandler["Auth Failure Handler"]:::security
    end
    click AuthConfig "https://github.com/ongcaoboi/proxtech-shop/blob/master/src/main/java/com/proxtechshop/config/WebSecurityConfig.java"
    click FailureHandler "https://github.com/ongcaoboi/proxtech-shop/blob/master/src/main/java/com/proxtechshop/config/AuthFailureHandlerConfig.java"

    %% Controller Layer
    subgraph ControllerLayer
        AdminControllers["Admin Controllers"]:::controller
        RestControllers["REST Controllers"]:::controller
        MainControllers["Main Controllers"]:::controller
    end
    click AdminControllers "https://github.com/ongcaoboi/proxtech-shop/tree/master/src/main/java/com/proxtechshop/admincontrollers/"
    click RestControllers "https://github.com/ongcaoboi/proxtech-shop/tree/master/src/main/java/com/proxtechshop/api/restcontrollers/"
    click MainControllers "https://github.com/ongcaoboi/proxtech-shop/tree/master/src/main/java/com/proxtechshop/controllers/"

    %% Service Layer
    subgraph ServiceLayer
        ProductService["Product Service"]:::service
        OrderService["Order Service"]:::service
        UserService["User Service"]:::service
        CartService["Cart Service"]:::service
        PaymentService["Payment Service"]:::service
    end
    click ProductService "https://github.com/ongcaoboi/proxtech-shop/blob/master/src/main/java/com/proxtechshop/services/ProductService.java"
    click OrderService "https://github.com/ongcaoboi/proxtech-shop/blob/master/src/main/java/com/proxtechshop/services/OrderService.java"
    click UserService "https://github.com/ongcaoboi/proxtech-shop/blob/master/src/main/java/com/proxtechshop/services/UserService.java"
    click CartService "https://github.com/ongcaoboi/proxtech-shop/blob/master/src/main/java/com/proxtechshop/services/CartService.java"
    click PaymentService "https://github.com/ongcaoboi/proxtech-shop/blob/master/src/main/java/com/proxtechshop/services/PaymentService.java"

    %% Repository Layer
    subgraph RepositoryLayer
        MainRepos["JPA Repositories"]:::repository
        CustomRepos["Custom Repositories"]:::repository
    end
    click MainRepos "https://github.com/ongcaoboi/proxtech-shop/tree/master/src/main/java/com/proxtechshop/repositories/"
    click CustomRepos "https://github.com/ongcaoboi/proxtech-shop/tree/master/src/main/java/com/proxtechshop/repositoryimpl/"

    %% Database Layer
    Database[(Database)]:::database

    %% Global Beans
    subgraph GlobalBeans
        GlobalData["Global Data Bean"]:::bean
        AppBean["Application Bean"]:::bean
    end
    click GlobalData "https://github.com/ongcaoboi/proxtech-shop/blob/master/src/main/java/com/proxtechshop/bean/GlobalDataBean.java"
    click AppBean "https://github.com/ongcaoboi/proxtech-shop/blob/master/src/main/java/com/proxtechshop/bean/ApplicationBean.java"

    %% View Templates
    subgraph ViewLayer
        Templates["Thymeleaf Templates"]:::view
        StaticRes["Static Resources"]:::view
    end
    click Templates "https://github.com/ongcaoboi/proxtech-shop/tree/master/src/main/resources/templates/"
    click StaticRes "https://github.com/ongcaoboi/proxtech-shop/tree/master/src/main/resources/public/assets/"

    %% API Models
    subgraph ModelLayer
        RequestModels["Request Models"]:::model
        ResponseModels["Response Models"]:::model
        Entities["Entities"]:::model
    end
    click RequestModels "https://github.com/ongcaoboi/proxtech-shop/tree/master/src/main/java/com/proxtechshop/api/request/"
    click ResponseModels "https://github.com/ongcaoboi/proxtech-shop/tree/master/src/main/java/com/proxtechshop/api/response/"
    click Entities "https://github.com/ongcaoboi/proxtech-shop/tree/master/src/main/java/com/proxtechshop/entities/"

    %% Relationships
    Browser --> SecurityFilter
    RestClients --> SecurityFilter
    SecurityFilter --> ControllerLayer
    ControllerLayer --> ServiceLayer
    ServiceLayer --> RepositoryLayer
    RepositoryLayer --> Database
    ControllerLayer --> Templates
    GlobalBeans --> ServiceLayer
    ModelLayer --> ServiceLayer

    %% Legend
    subgraph Legend
        Client["Client Layer"]:::client
        Sec["Security Layer"]:::security
        Cont["Controller Layer"]:::controller
        Serv["Service Layer"]:::service
        Repo["Repository Layer"]:::repository
        DB["Database Layer"]:::database
    end
```
