# happysloth0908/ddukdoc architecture

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

- Interactive diagram: https://gitdiagram.com/happysloth0908/ddukdoc
- Repository: https://github.com/happysloth0908/ddukdoc

## Overview

##### Project type and purpose
- DDUKDOC is a full‑stack web application for creating, signing, storing, and verifying digital documents with blockchain.
- Frontend: React + TypeScript SPA (Vite) that runs in the user’s browser.
- Backend: Monolithic Java Spring Boot application, broken into domain modules (auth, document, contract, user, share, template, material, notification, verification, superapp).
- Smart‑contract layer: Node.js script (contracts/index.js) interacting with a blockchain network.
- DevOps/CICD: Jenkins + GitLab pipelines, Docker, Blue‑Green deployments, ELK, SonarQube, Mattermost notifications.

##### File structure
- Top‑level folders:
- frontend – React SPA source, assets, API wrappers, state stores, mocks, Storybook stories, Vite config, Tailwind
- backend – Gradle‑based Spring Boot project with Dockerfile, security, config, domain packages, utilities (PDF, blockchain, encryption), infra clients (OAuth, Redis, S3)
- contracts – Node.js script + ABI JSON for blockchain interactions
- exec – database schema and seed scripts
- CI/CD: Jenkinsfile, .gitlab/ templates, sonar settings
- Deployment artifacts: Dockerfiles under backend/ and contracts/

##### Key insights from README
- Architecture uses environment isolation (dev/prod), Blue‑Green deployments, selective build & deploy by component, real‑time monitoring via ELK, SonarQube quality gate, Mattermost alerts.
- Security: JWT, OAuth2 (Kakao, SSAFY), envelope encryption via AWS KMS, file/data encryption strategies, S3 storage, Redis for sessions/cache.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Clients
    subgraph "Clients"
        Browser["Web Browser (SPA)"]:::frontend
    end

    %% Frontend
    subgraph "Frontend Layer"
        SPA["Frontend SPA"]:::frontend
        ViteCfg["Vite Config"]:::frontend
    end

    %% Backend API Layer
    subgraph "API Layer"
        Controllers["REST Controllers"]:::backend
    end

    %% Business Logic
    subgraph "Service Layer"
        Services["Domain Services"]:::backend
    end

    %% Persistence
    subgraph "Persistence Layer"
        Repos["Repositories"]:::storage
        DB["Relational Database"]:::storage
        RedisCache["Redis Cache & Session"]:::storage
    end

    %% Utilities & Adapters
    subgraph "Adapters & Utils"
        S3Util["AWS S3 Adapter"]:::storage
        S3Config["S3 Config"]:::storage
        KmsData["KMS Data Encryption"]:::security
        KmsFile["KMS File Encryption"]:::security
        BlockchainUtil["Blockchain Utilities"]:::backend
        SmartAdapter["Smart-Contract Adapter"]:::backend
        PDFGen["PDF Generation Module"]:::backend
        OAuthInfra["OAuth2 Infra"]:::external
        AuthStrategy["OAuth Strategies"]:::external
        ShareCtrl["Share Controller"]:::backend
        ShareSvc["Share Service"]:::backend
        SuperApp["SuperApp Module"]:::backend
    end

    %% External Systems
    subgraph "External Systems"
        S3["AWS S3"]:::external
        KMS["AWS KMS"]:::external
        OAuthProv["OAuth Providers"]:::external
        BlockchainNet["Blockchain Network"]:::external
    end

    %% Observability & Monitoring
    subgraph "Observability"
        ELK["ELK Stack"]:::devops
        Mattermost["Mattermost Alerts"]:::devops
    end

    %% CI/CD Pipeline
    subgraph "CI/CD & Deployment"
        Jenkins["Jenkinsfile"]:::devops
        MRTemplates["MR Templates"]:::devops
        DockerReg["Docker Registry"]:::devops
        BlueCluster["Blue/Green Clusters"]:::devops
        BackendDocker["Backend Dockerfile"]:::devops
        ContractsDocker["Contracts Dockerfile"]:::devops
    end

    %% Security & JWT
    subgraph "Security"
        JwtFilter["JwtAuthenticationFilter"]:::security
        JwtProvider["JwtTokenProvider"]:::security
        SecurityCfg["SecurityConfig"]:::security
    end

    %% Connections
    Browser --> SPA
    SPA --> Controllers
    Controllers --> Services
    Services --> Repos
    Services --> RedisCache
    Services --> S3Util
    Services --> PDFGen
    Services --> BlockchainUtil
    Services --> ShareSvc
    Controllers --> ShareCtrl
    Controllers --> SuperApp

    Repos --> DB
    RedisCache --> RedisCache

    S3Util --> S3
    S3Config --> S3
    KmsData --> KMS
    KmsFile --> KMS

    BlockchainUtil --> SmartAdapter
    SmartAdapter --> BlockchainNet

    SPA --> OAuthInfra
    OAuthInfra --> OAuthProv
    AuthStrategy --> OAuthInfra

    ShareSvc --> Mattermost
    ELK --> Mattermost
    Services --> ELK
    Controllers --> ELK

    Jenkins --> DockerReg
    MRTemplates --> Jenkins
    DockerReg --> BlueCluster
    BackendDocker --> BlueCluster
    ContractsDocker --> BlueCluster
    BlueCluster -->|traffic shift| SPA

    JwtFilter --> Controllers
    JwtProvider --> Controllers
    SecurityCfg --> Controllers

    %% Click Events
    click SPA "https://github.com/happysloth0908/ddukdoc/tree/master/frontend/src"
    click ViteCfg "https://github.com/happysloth0908/ddukdoc/blob/master/frontend/vite.config.ts"
    click Controllers "https://github.com/happysloth0908/ddukdoc/tree/master/backend/src/main/java/com/ssafy/ddukdoc/domain/*/controller"
    click Services "https://github.com/happysloth0908/ddukdoc/tree/master/backend/src/main/java/com/ssafy/ddukdoc/domain/*/service"
    click Repos "https://github.com/happysloth0908/ddukdoc/tree/master/backend/src/main/java/com/ssafy/ddukdoc/domain/*/repository"
    click RedisCache "https://github.com/happysloth0908/ddukdoc/blob/master/backend/src/main/java/com/ssafy/ddukdoc/global/config/RedisConfig.java"
    click RedisCache "https://github.com/happysloth0908/ddukdoc/blob/master/backend/src/main/java/com/ssafy/ddukdoc/domain/auth/service/AuthRedisService.java"
    click S3Util "https://github.com/happysloth0908/ddukdoc/blob/master/backend/src/main/java/com/ssafy/ddukdoc/global/common/util/S3Util.java"
    click S3Config "https://github.com/happysloth0908/ddukdoc/blob/master/backend/src/main/java/com/ssafy/ddukdoc/global/config/S3Config.java"
    click KmsData "https://github.com/happysloth0908/ddukdoc/blob/master/backend/src/main/java/com/ssafy/ddukdoc/global/common/util/encrypt/data/KmsEncryptionStrategy.java"
    click KmsFile "https://github.com/happysloth0908/ddukdoc/blob/master/backend/src/main/java/com/ssafy/ddukdoc/global/common/util/encrypt/file/KmsFileEncryptionStrategy.java"
    click BlockchainUtil "https://github.com/happysloth0908/ddukdoc/blob/master/backend/src/main/java/com/ssafy/ddukdoc/global/common/util/blockchain/BlockchainUtil.java"
    click SmartAdapter "https://github.com/happysloth0908/ddukdoc/blob/master/contracts/index.js"
    click OAuthInfra "https://github.com/happysloth0908/ddukdoc/tree/master/backend/src/main/java/com/ssafy/ddukdoc/global/infra/oauth"
    click AuthStrategy "https://github.com/happysloth0908/ddukdoc/tree/master/backend/src/main/java/com/ssafy/ddukdoc/domain/auth/service/strategy"
    click PDFGen "https://github.com/happysloth0908/ddukdoc/tree/master/backend/src/main/java/com/ssafy/ddukdoc/global/common/util/pdfgenerator"
    click ShareCtrl "https://github.com/happysloth0908/ddukdoc/blob/master/backend/src/main/java/com/ssafy/ddukdoc/domain/share/controller/ShareController.java"
    click ShareSvc "https://github.com/happysloth0908/ddukdoc/blob/master/backend/src/main/java/com/ssafy/ddukdoc/domain/share/service/ShareService.java"
    click Abi "https://github.com/happysloth0908/ddukdoc/blob/master/contracts/abi.json"
    click ContractsPkg "https://github.com/happysloth0908/ddukdoc/blob/master/contracts/package.json"
    click Jenkins "https://github.com/happysloth0908/ddukdoc/tree/master/Jenkinsfile"
    click MRTemplates "https://github.com/happysloth0908/ddukdoc/tree/master/.gitlab/merge_request_templates"
    click BackendDocker "https://github.com/happysloth0908/ddukdoc/tree/master/backend/Dockerfile"
    click ContractsDocker "https://github.com/happysloth0908/ddukdoc/tree/master/contracts/Dockerfile"
    click JwtFilter "https://github.com/happysloth0908/ddukdoc/blob/master/backend/src/main/java/com/ssafy/ddukdoc/global/security/jwt/JwtAuthenticationFilter.java"
    click JwtProvider "https://github.com/happysloth0908/ddukdoc/blob/master/backend/src/main/java/com/ssafy/ddukdoc/global/security/jwt/JwtTokenProvider.java"
    click SecurityCfg "https://github.com/happysloth0908/ddukdoc/blob/master/backend/src/main/java/com/ssafy/ddukdoc/global/config/security/SecurityConfig.java"
    click SuperApp "https://github.com/happysloth0908/ddukdoc/tree/master/backend/src/main/java/com/ssafy/ddukdoc/superapp"

    %% Classes
    classDef frontend fill:#D0E8FF,stroke:#0366D6,color:#0366D6
    classDef backend  fill:#E2F0D9,stroke:#228B22,color:#228B22
    classDef storage  fill:#FFE5B4,stroke:#FF8C00,color:#FF8C00
    classDef external fill:#F3E5F5,stroke:#800080,color:#800080
    classDef devops   fill:#E8E8E8,stroke:#808080,color:#808080
    classDef security fill:#FFE6E6,stroke:#FF0000,color:#FF0000
```
