# coooolfan/uniboard-service architecture

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

- Interactive diagram: https://gitdiagram.com/coooolfan/uniboard-service
- Repository: https://github.com/coooolfan/uniboard-service

## Overview

##### And Create the Main Components
- API Layer – Represent this with the “controller” components. They include FileController, FileRecordController, HyperLinkController, NoteController, ProfileController, ShortUrlController, and TokenController. They manage incoming REST requests.
- Data Access Layer – Represent the “repo” (repository) components such as FileRecordRepo, HyperLinkRepo, NoteRepo, ProfileRepo, and ShortUrlRepo. These govern the communication with the database.
- Configuration Components – Include components like the CacheConfig and SaTokenFilter which hint at caching strategies and token‐based access control/filtering.
- Error Handling – Represent the error components, including GlobalExceptionHandler and various error code classes, as a cross‑cutting concern that applies across the application layers.

##### Component Relationships and Data Flow
- Configuration block interacting with various layers (for instance, caching applied at the Service or Repository level and token filtering applied at entry points).

##### Architectural Patterns and Relevant Technologies
- That the project follows the layered architecture (commonly MVC for controllers/views logic even though it’s for a RESTful API) by separating Controllers, Services, and Repositories.
- Use of DTOs to segregate domain models from API payloads.
- Annotations or labels for Spring Boot, noticing that the application leverages Spring’s dependency injection, configuration management (via application.properties), and RESTful service setup.
- Mention Gradle as the build tool and Docker Compose for container orchestration during deployment.
- Optionally, you might include pointers to external services or frameworks (e.g., caching technology or the SaToken authentication filter).

- External integrations like the CI/CD pipelines indicated by GitHub Workflows, which lead to Docker image builds.
- Optionally, indicate environment dependencies (noting the presence of the .env file).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% External Client
    EC["External Client"]:::external

    %% API Layer - Controllers
    subgraph "API Layer (Controllers)"
        FC["FileController"]:::controller
        FRC["FileRecordController"]:::controller
        HC["HyperLinkController"]:::controller
        NC["NoteController"]:::controller
        PC["ProfileController"]:::controller
        SC["ShortUrlController"]:::controller
        TC["TokenController"]:::controller
    end

    %% Service Layer
    subgraph "Service Layer"
        FS["FileService"]:::service
        FRS["FileRecordService"]:::service
        HS["HyperLinkService"]:::service
        PS["ProfileService"]:::service
        NS["NoteService"]:::service
        SS["ShortUrlService"]:::service
    end

    %% Data Access Layer - Repositories
    subgraph "Data Access Layer (Repositories)"
        FRP["FileRecordRepo"]:::repo
        HRP["HyperLinkRepo"]:::repo
        NR["NoteRepo"]:::repo
        PRP["ProfileRepo"]:::repo
        SRP["ShortUrlRepo"]:::repo
    end

    %% Domain / Model Layer
    subgraph "Domain / Model Layer"
        subgraph "Domain Models"
            DM1["FileRecord"]:::model
            DM2["HyperLink"]:::model
            DM3["Note"]:::model
            DM4["Profile"]:::model
            DM5["ShortUrl"]:::model
            DM6["BaseSimpleFile"]:::model
            DM7["ProfileContacts"]:::model
            DM8["FileRecordType"]:::model
        end
        subgraph "DTOs"
            DTO1["FileRecordDTO"]:::model
            DTO2["HyperLinkDTO"]:::model
            DTO3["NoteDTO"]:::model
            DTO4["ProfileDTO"]:::model
            DTO5["ShortUrlDTO"]:::model
        end
    end

    %% Configuration Components
    subgraph "Configuration"
        CC["CacheConfig"]:::config
        ST["SaTokenFilter"]:::config
    end

    %% Error Handling
    subgraph "Error Handling"
        GEX["GlobalExceptionHandler"]:::error
        CEC["CommonErrorCode"]:::error
        FEC["FileRecordErrorCode"]:::error
        PEC["ProfileErrorCode"]:::error
    end

    %% Infrastructure & Deployment
    subgraph "Infrastructure & Deployment"
        BG["build.gradle.kts"]:::infra
        SG["settings.gradle.kts"]:::infra
        DC["docker-compose.yml"]:::infra
        DW["docker-builder.yml"]:::infra
    end

    %% Relationships

    %% External to API Layer
    EC -->|"HTTPRequest"| FC
    EC -->|"HTTPRequest"| FRC
    EC -->|"HTTPRequest"| HC
    EC -->|"HTTPRequest"| NC
    EC -->|"HTTPRequest"| PC
    EC -->|"HTTPRequest"| SC
    EC -->|"HTTPRequest"| TC

    %% API Layer to Service Layer
    FC -->|"calls"| FS
    FRC -->|"calls"| FRS
    HC -->|"calls"| HS
    NC -->|"calls"| NS
    PC -->|"calls"| PS
    SC -->|"calls"| SS
    %% TokenController could interact with authentication filters
    TC -->|"filteredBy"| ST

    %% Service Layer to Data Access Layer
    FS -->|"accesses"| FRP
    FRS -->|"accesses"| FRP
    HS -->|"accesses"| HRP
    NS -->|"accesses"| NR
    PS -->|"accesses"| PRP
    SS -->|"accesses"| SRP

    %% Repositories to Database (represented as a cylinder)
    subgraph "Database"
        DB[(Database)]
    end
    FRP --> DB
    HRP --> DB
    NR  --> DB
    PRP --> DB
    SRP --> DB

    %% Controllers to Error Handling (global error handling flow)
    FC ---|"errors"| GEX
    FRC ---|"errors"| GEX
    HC ---|"errors"| GEX
    NC ---|"errors"| GEX
    PC ---|"errors"| GEX
    SC ---|"errors"| GEX
    TC ---|"errors"| GEX

    %% Configuration applied to Service Layer
    CC ---|"caches"| FS
    CC ---|"caches"| FRS
    CC ---|"caches"| HS
    CC ---|"caches"| PS
    CC ---|"caches"| NS
    CC ---|"caches"| SS

    %% Infrastructure supports deployment of the application (conceptual arrow)
    DW ---|"CI/CD"| DC
    BG ---|"builds"| SG

    %% Click Events for Component Mapping

    %% Controllers
    click FC "https://github.com/coooolfan/uniboard-service/blob/main/src/main/kotlin/com/coooolfan/uniboard/controller/FileController.kt"
    click FRC "https://github.com/coooolfan/uniboard-service/blob/main/src/main/kotlin/com/coooolfan/uniboard/controller/FileRecordController.kt"
    click HC "https://github.com/coooolfan/uniboard-service/blob/main/src/main/kotlin/com/coooolfan/uniboard/controller/HyperLinkController.kt"
    click NC "https://github.com/coooolfan/uniboard-service/blob/main/src/main/kotlin/com/coooolfan/uniboard/controller/NoteController.kt"
    click PC "https://github.com/coooolfan/uniboard-service/blob/main/src/main/kotlin/com/coooolfan/uniboard/controller/ProfileController.kt"
    click SC "https://github.com/coooolfan/uniboard-service/blob/main/src/main/kotlin/com/coooolfan/uniboard/controller/ShortUrlController.kt"
    click TC "https://github.com/coooolfan/uniboard-service/blob/main/src/main/kotlin/com/coooolfan/uniboard/controller/TokenController.kt"

    %% Services
    click FS "https://github.com/coooolfan/uniboard-service/blob/main/src/main/kotlin/com/coooolfan/uniboard/service/FileService.kt"
    click FRS "https://github.com/coooolfan/uniboard-service/blob/main/src/main/kotlin/com/coooolfan/uniboard/service/FileRecordService.kt"
    click HS "https://github.com/coooolfan/uniboard-service/blob/main/src/main/kotlin/com/coooolfan/uniboard/service/HyperLinkService.kt"
    click PS "https://github.com/coooolfan/uniboard-service/blob/main/src/main/kotlin/com/coooolfan/uniboard/service/ProfileService.kt"

    %% Repositories
    click FRP "https://github.com/coooolfan/uniboard-service/blob/main/src/main/kotlin/com/coooolfan/uniboard/repo/FileRecordRepo.kt"
    click HRP "https://github.com/coooolfan/uniboard-service/blob/main/src/main/kotlin/com/coooolfan/uniboard/repo/HyperLinkRepo.kt"
    click NR "https://github.com/coooolfan/uniboard-service/blob/main/src/main/kotlin/com/coooolfan/uniboard/repo/NoteRepo.kt"
    click PRP "https://github.com/coooolfan/uniboard-service/blob/main/src/main/kotlin/com/coooolfan/uniboard/repo/ProfileRepo.kt"
    click SRP "https://github.com/coooolfan/uniboard-service/blob/main/src/main/kotlin/com/coooolfan/uniboard/repo/ShortUrlRepo.kt"

    %% Domain Models
    click DM1 "https://github.com/coooolfan/uniboard-service/blob/main/src/main/kotlin/com/coooolfan/uniboard/model/FileRecord.kt"
    click DM2 "https://github.com/coooolfan/uniboard-service/blob/main/src/main/kotlin/com/coooolfan/uniboard/model/HyperLink.kt"
    click DM3 "https://github.com/coooolfan/uniboard-service/blob/main/src/main/kotlin/com/coooolfan/uniboard/model/Note.kt"
    click DM4 "https://github.com/coooolfan/uniboard-service/blob/main/src/main/kotlin/com/coooolfan/uniboard/model/Profile.kt"
    click DM5 "https://github.com/coooolfan/uniboard-service/blob/main/src/main/kotlin/com/coooolfan/uniboard/model/ShortUrl.kt"
    click DM6 "https://github.com/coooolfan/uniboard-service/blob/main/src/main/kotlin/com/coooolfan/uniboard/model/BaseSimpleFile.kt"
    click DM7 "https://github.com/coooolfan/uniboard-service/blob/main/src/main/kotlin/com/coooolfan/uniboard/model/ProfileContacts.kt"
    click DM8 "https://github.com/coooolfan/uniboard-service/blob/main/src/main/kotlin/com/coooolfan/uniboard/model/FileRecordType.kt"

    %% DTOs
    click DTO1 "https://github.com/coooolfan/uniboard-service/blob/main/src/main/dto/FileRecord.dto"
    click DTO2 "https://github.com/coooolfan/uniboard-service/blob/main/src/main/dto/HyperLink.dto"
    click DTO3 "https://github.com/coooolfan/uniboard-service/blob/main/src/main/dto/Note.dto"
    click DTO4 "https://github.com/coooolfan/uniboard-service/blob/main/src/main/dto/Profile.dto"
    click DTO5 "https://github.com/coooolfan/uniboard-service/blob/main/src/main/dto/ShortUrl.dto"

    %% Configuration
    click CC "https://github.com/coooolfan/uniboard-service/blob/main/src/main/kotlin/com/coooolfan/uniboard/config/CacheConfig.kt"
    click ST "https://github.com/coooolfan/uniboard-service/blob/main/src/main/kotlin/com/coooolfan/uniboard/config/SaTokenFilter.kt"

    %% Error Handling
    click GEX "https://github.com/coooolfan/uniboard-service/blob/main/src/main/kotlin/com/coooolfan/uniboard/error/GlobalExceptionHandler.kt"
    click CEC "https://github.com/coooolfan/uniboard-service/blob/main/src/main/kotlin/com/coooolfan/uniboard/error/CommonErrorCode.kt"
    click FEC "https://github.com/coooolfan/uniboard-service/blob/main/src/main/kotlin/com/coooolfan/uniboard/error/FileRecordErrorCode.kt"
    click PEC "https://github.com/coooolfan/uniboard-service/blob/main/src/main/kotlin/com/coooolfan/uniboard/error/ProfileErrorCode.kt"

    %% Infrastructure & Deployment
    click BG "https://github.com/coooolfan/uniboard-service/blob/main/build.gradle.kts"
    click SG "https://github.com/coooolfan/uniboard-service/blob/main/settings.gradle.kts"
    click DC "https://github.com/coooolfan/uniboard-service/blob/main/docker-compose.yml"
    click DW "https://github.com/coooolfan/uniboard-service/blob/main/.github/workflows/docker-builder.yml"

    %% Styles
    classDef controller fill:#ffdecc,stroke:#b35900,stroke-width:2px;
    classDef service fill:#d6e9ff,stroke:#1a75ff,stroke-width:2px;
    classDef repo fill:#fff2cc,stroke:#e69138,stroke-width:2px;
    classDef model fill:#d9ead3,stroke:#38761d,stroke-width:2px;
    classDef config fill:#d0e0e3,stroke:#115740,stroke-width:2px;
    classDef error fill:#f4cccc,stroke:#cc0000,stroke-width:2px;
    classDef infra fill:#e0e0e0,stroke:#808080,stroke-width:2px;
    classDef external fill:#c9daf8,stroke:#0b5394,stroke-width:2px;
```
