# uckgiduckgi/payall-be architecture

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

- Interactive diagram: https://gitdiagram.com/uckgiduckgi/payall-be
- Repository: https://github.com/uckgiduckgi/payall-be

## Overview

##### Project type and purpose
- This is a Java Spring Boot backend service (“PayAll_BE”) that implements a monolithic, layered architecture.
- It exposes a REST API for customers to manage accounts, carts, payments, products, purchases, receipts, recommendations, searches, statistics, stores, and users.
- It also provides global concerns: authentication/authorization (JWT + Redis), external integrations (crawling product API, MyData API), configuration (Redis, RestTemplate, Swagger), health-monitoring, and exception handling.

##### File structure
- Top-level: build scripts (Gradle), CI/CD workflows, settings, and a README (minimal content).
- src/main/java/com/example/PayAll_BE:
- customer/* – contains subpackages for each business domain, each following the pattern:
– Entity class
– Repository (Spring Data JPA)
– Service (business logic)
– Controller (REST endpoints)
– DTOs and Mappers for input/output
- global/* – cross-cutting modules:
– api (standard ApiResult wrapper)
– auth (controllers, services for login/register/refresh, JwtService, RedisService)
– config (RedisConfig, RestTemplateConfig, SwaggerConfig, security setup, monitoring beans)
– crawlingProduct (HTTP client for external product data)
– exception (custom exceptions and global handler)
– mydata (controllers and services for integrating with external MyData API)
- src/main/resources: simple resource file (temp.txt)
- src/test/java: unit tests for each controller and integration points

##### README
- The README contains only a placeholder link to the project owner’s GitHub.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Client
    C["Client"]:::client

    %% API Layer
    subgraph "API Layer"
        CC["Customer Controllers\n(account, cart, payment, ...)"]:::api
        AC["AuthController"]:::api
        MC["MyDataController"]:::api
    end

    %% Service Layer
    subgraph "Service Layer"
        CS["Customer Services\n(account, cart, payment, ...)"]:::service
        AS["AuthService"]:::service
        JS["JwtService"]:::service
        RS["RedisService"]:::service
        MS["MyDataService"]:::service
        CatS["CategoryService"]:::service
    end

    %% Persistence Layer
    subgraph "Persistence Layer"
        CR["Customer Repositories\n(account, cart, payment, ...)"]:::repo
        E["Customer Entities\n(Account, Cart, Payment, ...)"]:::entity
        DB[(Relational Database)]:::db
        RedisStore[(Redis)]:::redis
    end

    %% External Integrations
    subgraph "External Integrations"
        CrawlAPI["CrawlingProductApiClient"]:::external
        CrawlExt((External Product API)):::external
        MyDataExt((MyData API)):::external
    end

    %% Infrastructure Configurations
    subgraph "Infrastructure"
        RC["RedisConfig"]:::config
        RTC["RestTemplateConfig"]:::config
        SCfg["SwaggerConfig"]:::config
    end

    %% Security Config & Filters
    subgraph "Security"
        SCF["SecurityConfig"]:::config
        JAF["JwtAuthenticationFilter"]:::auth
        CCF["CryptoConfig"]:::config
        CU["CryptoUtil"]:::config
    end

    %% Cross-cutting concerns
    AR["ApiResult Wrapper"]:::config
    EH["GlobalExceptionHandler"]:::exception
    HI["CustomHealthIndicator"]:::config
    CI["CustomInfoContributor"]:::config

    %% Relationships
    C --> CC
    C --> AC
    C --> MC

    CC --> CS
    AC --> AS
    AC --> JS
    AC --> RS
    MC --> MS

    CS --> CR
    CS --> CrawlAPI
    MS --> MyDataExt
    CrawlAPI --> CrawlExt

    CR --> E
    CR --> DB
    RS --> RedisStore
    JS --> RedisStore

    AS --> JS
    AS --> RS
    AS --> RTC

    CC --> AR
    AC --> AR
    MC --> AR

    CC --> EH
    AC --> EH
    MC --> EH
    CS --> EH
    AS --> EH

    %% Click Events
    click CC "https://github.com/uckgiduckgi/payall-be/blob/develop/src/main/java/com/example/PayAll_BE/customer/*/*Controller.java"
    click AC "https://github.com/uckgiduckgi/payall-be/blob/develop/src/main/java/com/example/PayAll_BE/global/auth/controller/AuthController.java"
    click MC "https://github.com/uckgiduckgi/payall-be/blob/develop/src/main/java/com/example/PayAll_BE/global/mydata/controller/MydataController.java"
    click CS "https://github.com/uckgiduckgi/payall-be/blob/develop/src/main/java/com/example/PayAll_BE/customer/*/*Service.java"
    click AS "https://github.com/uckgiduckgi/payall-be/blob/develop/src/main/java/com/example/PayAll_BE/global/auth/service/AuthService.java"
    click JS "https://github.com/uckgiduckgi/payall-be/blob/develop/src/main/java/com/example/PayAll_BE/global/auth/service/JwtService.java"
    click RS "https://github.com/uckgiduckgi/payall-be/blob/develop/src/main/java/com/example/PayAll_BE/global/auth/service/RedisService.java"
    click MS "https://github.com/uckgiduckgi/payall-be/blob/develop/src/main/java/com/example/PayAll_BE/global/mydata/service/MydataService.java"
    click CatS "https://github.com/uckgiduckgi/payall-be/blob/develop/src/main/java/com/example/PayAll_BE/global/mydata/service/CategoryService.java"
    click CR "https://github.com/uckgiduckgi/payall-be/blob/develop/src/main/java/com/example/PayAll_BE/customer/*/*Repository.java"
    click E "https://github.com/uckgiduckgi/payall-be/blob/develop/src/main/java/com/example/PayAll_BE/customer/*/*.java"
    click SCF "https://github.com/uckgiduckgi/payall-be/blob/develop/src/main/java/com/example/PayAll_BE/global/config/security/SecurityConfig.java"
    click JAF "https://github.com/uckgiduckgi/payall-be/blob/develop/src/main/java/com/example/PayAll_BE/global/config/security/JwtAuthenticationFilter.java"
    click CCF "https://github.com/uckgiduckgi/payall-be/blob/develop/src/main/java/com/example/PayAll_BE/global/config/security/CryptoConfig.java"
    click CU "https://github.com/uckgiduckgi/payall-be/blob/develop/src/main/java/com/example/PayAll_BE/global/config/security/CryptoUtil.java"
    click RC "https://github.com/uckgiduckgi/payall-be/blob/develop/src/main/java/com/example/PayAll_BE/global/config/RedisConfig.java"
    click RTC "https://github.com/uckgiduckgi/payall-be/blob/develop/src/main/java/com/example/PayAll_BE/global/config/RestTemplateConfig.java"
    click SCfg "https://github.com/uckgiduckgi/payall-be/blob/develop/src/main/java/com/example/PayAll_BE/global/config/SwaggerConfig.java"
    click HI "https://github.com/uckgiduckgi/payall-be/blob/develop/src/main/java/com/example/PayAll_BE/global/config/monitoring/CustomHealthIndicator.java"
    click CI "https://github.com/uckgiduckgi/payall-be/blob/develop/src/main/java/com/example/PayAll_BE/global/config/monitoring/CustomInfoContributor.java"
    click EH "https://github.com/uckgiduckgi/payall-be/blob/develop/src/main/java/com/example/PayAll_BE/global/exception/GlobalExceptionHandler.java"
    click CrawlAPI "https://github.com/uckgiduckgi/payall-be/blob/develop/src/main/java/com/example/PayAll_BE/global/crawlingProduct/CrawlingProductApiClient.java"
    click AR "https://github.com/uckgiduckgi/payall-be/blob/develop/src/main/java/com/example/PayAll_BE/global/api/ApiResult.java"

    %% Styles
    classDef client fill:#f9f,stroke:#333,stroke-width:1px
    classDef api fill:#bbf,stroke:#333,stroke-width:1px
    classDef service fill:#bfb,stroke:#333,stroke-width:1px
    classDef repo fill:#fbf,stroke:#333,stroke-width:1px
    classDef entity fill:#fdd,stroke:#333,stroke-width:1px
    classDef db fill:#fff,stroke:#333,stroke-width:1px,stroke-dasharray: 5 5
    classDef redis fill:#eef,stroke:#333,stroke-width:1px
    classDef external fill:#ffc,stroke:#333,stroke-width:1px,stroke-dasharray: 5 5
    classDef config fill:#ddd,stroke:#333,stroke-width:1px
    classDef auth fill:#fbb,stroke:#333,stroke-width:1px
    classDef exception fill:#fee,stroke:#333,stroke-width:1px
```
