# gurummang/file-repo architecture

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

- Interactive diagram: https://gitdiagram.com/gurummang/file-repo
- Repository: https://github.com/gurummang/file-repo

## Overview

##### Project Type and Purpose
- This is a standalone Spring Boot microservice (“FileHistory”) that exposes REST endpoints for file scanning, history tracking, and dashboard reporting.
- It integrates with external systems: AWS S3 for file storage, RabbitMQ for event-driven processing, Slack for notifications, and a relational database for persistence.

##### File‐Structure Analysis
- Top-level artifacts: build.gradle, Dockerfile, AWS task definition (config/FileTaskDefinition.json)
- src/main/java/com/GASB/file: a layered package structure following Controller → Service → Repository → Entity.
- Config packages: aws (S3), rabbitmq (message broker), slack (notification), cors, and annotation (JWT security).
- Services break down by concern: filescan, history, dashboard, tlsh (fuzzy hashing), rabbitmq listener.
- Repositories under file, org, user implement Spring Data JPA interfaces.

##### Key Architectural Patterns
- Layered architecture: HTTP Controllers delegate to Service classes, which in turn call Repositories or external APIs.
- Aspect-Oriented programming for JWT validation and input validation.
- Event-driven message consumption via RabbitMQListener.
- Integration modules for external systems: AWS SDK for S3, Slack API client, RabbitMQ AMQP client.
- Dockerized for container deployment, with AWS ECS task definition and Gradle build.

## Diagram (Mermaid)

```mermaid
graph TB
    %% External Interfaces
    HTTPClient["HTTP Client"]:::external
    LoadBalancer["Load Balancer / API Gateway"]:::infra
    AWS_S3["AWS S3"]:::external
    RabbitMQ_Broker["RabbitMQ Broker"]:::external
    Slack_API["Slack API"]:::external

    %% Infrastructure
    AWS_ECS["AWS ECS"]:::infra

    %% Docker Boundary
    subgraph "Docker Container" 
        direction TB

        FileApp["Application Entry Point\n(FileApplication)"]:::config
        subgraph "Config & Security"
            direction TB
            S3Config["S3Config"]:::config
            RabbitMQConfig["RabbitMQConfig"]:::config
            RabbitMQProps["RabbitMQProperties"]:::config
            SlackConfig["ServiceConfig"]:::config
            SlackExtract["ExtractData"]:::config
            CORSConfig["CORSconfig"]:::config
            JWTAspect["JWTValidationAspect"]:::config
            ValidateJWT["ValidateJWT"]:::config
            JWTResp["JwtValidationResponse"]:::config
        end

        subgraph "API Layer"
            direction TB
            FileController["FileController"]:::controller
        end

        subgraph "Service Layer"
            direction TB
            FileScanSvc["FileScanService"]:::service
            subgraph "History Services"
                direction TB
                FileHistorySvc["FileHistoryService"]:::service
                FileSimCompute["FileSimilarComputingService"]:::service
                FileSimAsync["FileSimilarityAsyncService"]:::service
                TlshComparator["TlshFileComparator"]:::service
                FileHistoryStats["FileHistoryStatisticsService"]:::service
                FileGroupSvc["FileGroupService"]:::service
                VisualizeSvc["VisualizeService"]:::service
            end
            DashboardSvc["FileBoardReturnService"]:::service
            RabbitListener["RabbitMQListener"]:::service
            subgraph "TLSH Utilities"
                direction TB
                TlshCore["Tlsh"]:::util
                TlshUtil["TlshUtil"]:::util
                TlshCreator["TlshCreator"]:::util
                BucketOpt["BucketOption"]:::util
                ChecksumOpt["ChecksumOption"]:::util
                VersionOpt["VersionOption"]:::util
            end
        end

        subgraph "Persistence Layer"
            direction TB
            Repos_File["File Repositories"]:::repo
            Repos_Org["Org Repositories"]:::repo
            Repos_User["User Repositories"]:::repo
            RelationalDB[(Relational DB)]:::external
        end
    end

    %% Flows
    HTTPClient -->|HTTP Request| LoadBalancer
    LoadBalancer -->|forwards| FileController
    FileController -->|"calls"| FileScanSvc
    FileController -->|"calls"| FileHistorySvc
    FileController -->|"calls"| DashboardSvc

    FileScanSvc -->|reads/writes| AWS_S3
    FileScanSvc -->|"uses repo"| Repos_File

    FileHistorySvc -->|"uses repo"| Repos_File
    FileHistorySvc -->|"publishes"| RabbitMQ_Broker

    RabbitMQ_Broker -->|"pushes"| RabbitListener
    RabbitListener -->|"calls"| FileSimCompute
    FileSimCompute -->|"calls"| TlshComparator
    FileSimCompute -->|"uses"| TlshCore
    FileSimAsync -->|"async compute"| FileSimCompute

    FileHistoryStats -->|"statistics"| RelationalDB
    FileGroupSvc -->|"grouping"| RelationalDB
    VisualizeSvc -->|"visual data"| RelationalDB

    DashboardSvc -->|"reads"| RelationalDB

    FileHistorySvc -->|"notify"| Slack_API
    DashboardSvc -->|"notify"| Slack_API

    FileController --- JWTAspect
    JWTAspect --- ValidateJWT
    ValidateJWT --- JWTResp

    %% Infrastructure connections
    AWS_ECS -->|runs| Dockerfile[("Dockerfile")]:::infra
    AWS_ECS -->|uses| configTask[("FileTaskDefinition.json")]:::infra

    %% Click Events
    click FileController "https://github.com/gurummang/file-repo/blob/main/src/main/java/com/GASB/file/controller/list/FileController.java"
    click FileScanSvc "https://github.com/gurummang/file-repo/blob/main/src/main/java/com/GASB/file/service/filescan/FileScanListService.java"
    click FileHistorySvc "https://github.com/gurummang/file-repo/blob/main/src/main/java/com/GASB/file/service/history/FileHistoryService.java"
    click FileSimCompute "https://github.com/gurummang/file-repo/blob/main/src/main/java/com/GASB/file/service/history/FileSimilarComputingService.java"
    click FileSimAsync "https://github.com/gurummang/file-repo/blob/main/src/main/java/com/GASB/file/service/history/FileSimilarityAsyncService.java"
    click TlshComparator "https://github.com/gurummang/file-repo/blob/main/src/main/java/com/GASB/file/service/history/TlshFileComparator.java"
    click FileHistoryStats "https://github.com/gurummang/file-repo/blob/main/src/main/java/com/GASB/file/service/history/FileHistoryStatisticsService.java"
    click FileGroupSvc "https://github.com/gurummang/file-repo/blob/main/src/main/java/com/GASB/file/service/history/FileGroupService.java"
    click VisualizeSvc "https://github.com/gurummang/file-repo/blob/main/src/main/java/com/GASB/file/service/history/VisualizeService.java"
    click DashboardSvc "https://github.com/gurummang/file-repo/blob/main/src/main/java/com/GASB/file/service/dashboard/FileBoardReturnService.java"
    click RabbitListener "https://github.com/gurummang/file-repo/blob/main/src/main/java/com/GASB/file/service/rabbitmq/RabbitMQListener.java"
    click TlshCore "https://github.com/gurummang/file-repo/blob/main/src/main/java/com/GASB/file/service/tlsh/Tlsh.java"
    click TlshUtil "https://github.com/gurummang/file-repo/blob/main/src/main/java/com/GASB/file/service/tlsh/TlshUtil.java"
    click TlshCreator "https://github.com/gurummang/file-repo/blob/main/src/main/java/com/GASB/file/service/tlsh/TlshCreator.java"
    click BucketOpt "https://github.com/gurummang/file-repo/blob/main/src/main/java/com/GASB/file/service/tlsh/BucketOption.java"
    click ChecksumOpt "https://github.com/gurummang/file-repo/blob/main/src/main/java/com/GASB/file/service/tlsh/ChecksumOption.java"
    click VersionOpt "https://github.com/gurummang/file-repo/blob/main/src/main/java/com/GASB/file/service/tlsh/VersionOption.java"
    click Repos_File "https://github.com/gurummang/file-repo/tree/main/src/main/java/com/GASB/file/repository/file"
    click Repos_Org "https://github.com/gurummang/file-repo/tree/main/src/main/java/com/GASB/file/repository/org"
    click Repos_User "https://github.com/gurummang/file-repo/tree/main/src/main/java/com/GASB/file/repository/user"
    click S3Config "https://github.com/gurummang/file-repo/blob/main/src/main/java/com/GASB/file/config/aws/S3Config.java"
    click RabbitMQConfig "https://github.com/gurummang/file-repo/blob/main/src/main/java/com/GASB/file/config/rabbitmq/RabbitMQConfig.java"
    click RabbitMQProps "https://github.com/gurummang/file-repo/blob/main/src/main/java/com/GASB/file/config/rabbitmq/RabbitMQProperties.java"
    click SlackConfig "https://github.com/gurummang/file-repo/blob/main/src/main/java/com/GASB/file/config/slack/ServiceConfig.java"
    click SlackExtract "https://github.com/gurummang/file-repo/blob/main/src/main/java/com/GASB/file/config/slack/ExtractData.java"
    click JWTAspect "https://github.com/gurummang/file-repo/blob/main/src/main/java/com/GASB/file/annotation/JWT/JWTValidationAspect.java"
    click ValidateJWT "https://github.com/gurummang/file-repo/blob/main/src/main/java/com/GASB/file/annotation/JWT/ValidateJWT.java"
    click JWTResp "https://github.com/gurummang/file-repo/blob/main/src/main/java/com/GASB/file/annotation/JWT/JwtValidationResponse.java"
    click CORSConfig "https://github.com/gurummang/file-repo/blob/main/src/main/java/com/GASB/file/config/cors/CORSconfig.java"
    click FileApp "https://github.com/gurummang/file-repo/blob/main/src/main/java/com/GASB/file/FileApplication.java"
    click Dockerfile "https://github.com/gurummang/file-repo/tree/main/Dockerfile"
    click configTask "https://github.com/gurummang/file-repo/blob/main/config/FileTaskDefinition.json"

    %% Styles
    classDef controller fill:#f9f,stroke:#333,stroke-width:1px
    classDef service fill:#9f9,stroke:#333,stroke-width:1px
    classDef repo fill:#ccf,stroke:#333,stroke-width:1px
    classDef external fill:#ffa,stroke:#333,stroke-width:1px
    classDef infra fill:#ddd,stroke:#333,stroke-width:1px
    classDef config fill:#fcf,stroke:#333,stroke-width:1px
    classDef util fill:#cff,stroke:#333,stroke-width:1px
```
