# seungineer/modoocoin-java architecture

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

- Interactive diagram: https://gitdiagram.com/seungineer/modoocoin-java
- Repository: https://github.com/seungineer/modoocoin-java

## Overview

##### Project Overview
- Project Type and Purpose:
– This is a Java-based application named “ModooCoin-JAVA” (모두의 코인 - 자바 ver.) intended to work with cryptocurrency data/services.
– It appears to be a full-stack style application, with distinct modules handling connectivity with an external exchange (Upbit), client-side services, display functionality, and server-side operations.

##### Main Components Identification
- Client Module:
– Located in src/client, it includes UpbitClient.java which likely interacts with the Upbit API.
– Contains various DTO classes (CoinDataDTO, PositionDTO, TradingHistoryDTO, UserProfileDTO) that encapsulate data passed between layers.
– Features services (TradingService.java, UserService.java) which likely implement core business logic such as trading operations and user management.
– A test subdirectory indicates unit or integration tests for the client functionality.
- Module:
– Found in src/display, this module is responsible for rendering coin information.
– The DisplayClient.java is the main entry point for the display logic.
– It uses components like CoinListHandler in the component package, data classes (Coin), and makes use of utility classes (JsonParser) and type definitions (CoinType).
- Server Module:
– Located in src/server, with Main.java acting as the entry point.
– The Handler subdirectory contains classes such as ClientHandler and UpbitWebSocketClient that likely manage incoming WebSocket connections and client communication.

##### Relationships and Data Flow
- The Client module fetches and prepares data by interfacing with the Upbit API (via UpbitClient) and processing it through various services and DTOs.
- The Display module consumes coin-related data (possibly received via the server) and handles how this data is presented to users - using components like CoinListHandler together with utility helpers for JSON parsing.
- The Server module serves as the central hub possibly coordinating requests coming from the client side, managing communication between the Upbit client and established display services. It also likely handles WebSocket communications (via UpbitWebSocketClient) to push real-time updates.

##### Architectural Patterns and Technologies
- Modular Separation: The clear splitting into client, display, and server modules suggests a modular layered architecture, which could leverage a variation of the MVC pattern (Model handling via DTOs, View represented by display components, and Controller aspects in services and server handlers).
- Data Transformation: The use of DTOs across modules suggests data is strictly defined and transformed as it passes between the layers.
- Tools & Frameworks: Since this is a Java project, standard Java libraries are used; potential integration with external APIs (Upbit), and possible testing frameworks (as indicated by the test directories).

##### Final Touches
- Avoid oversimplification – include intermediary steps or sub-components as described in the project, especially focusing on the clear modular separation.
- Verify that every major Java package and component (client, display, server) is represented, along with their interrelationships.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% External Component
    extAPI["Upbit API / External Service"]:::external

    %% Client Module
    subgraph "Client Module"
        direction TB
        clientUpbit["UpbitClient"]:::client
        dto1["CoinDataDTO"]:::client
        dto2["PositionDTO"]:::client
        dto3["TradingHistoryDTO"]:::client
        dto4["UserProfileDTO"]:::client
        tradingService["TradingService"]:::client
        userService["UserService"]:::client
        clientTest["Client Tests"]:::client
    end

    %% Server Module
    subgraph "Server Module"
        direction TB
        serverMain["Main"]:::server
        clientHandler["ClientHandler"]:::server
        wsClient["UpbitWebSocketClient"]:::server
    end

    %% Display Module
    subgraph "Display Module"
        direction TB
        displayClient["DisplayClient"]:::display
        coinListHandler["CoinListHandler"]:::display
        coinDTO["Coin"]:::display
        coinType["CoinType"]:::display
        jsonParser["JsonParser"]:::display
    end

    %% Relationships
    extAPI -->|"fetches_data"| clientUpbit
    clientUpbit -->|"processes"| tradingService
    clientUpbit -->|"processes"| userService
    clientUpbit -->|"maps_to"| dto1
    clientUpbit -->|"maps_to"| dto2
    clientUpbit -->|"maps_to"| dto3
    clientUpbit -->|"maps_to"| dto4
    tradingService -->|"sends_trading_info"| serverMain
    userService -->|"sends_user_info"| serverMain
    serverMain -->|"handles_connection"| clientHandler
    serverMain -->|"manages_WS"| wsClient
    serverMain -->|"pushes_realtime_data"| displayClient
    displayClient -->|"renders_with"| coinListHandler
    coinListHandler -->|"parses_data"| jsonParser
    coinListHandler -->|"displays"| coinDTO
    coinDTO -->|"defines_type"| coinType

    %% Click Events
    click clientUpbit "https://github.com/seungineer/modoocoin-java/blob/main/src/client/UpbitClient.java"
    click dto1 "https://github.com/seungineer/modoocoin-java/blob/main/src/client/dto/CoinDataDTO.java"
    click dto2 "https://github.com/seungineer/modoocoin-java/blob/main/src/client/dto/PositionDTO.java"
    click dto3 "https://github.com/seungineer/modoocoin-java/blob/main/src/client/dto/TradingHistoryDTO.java"
    click dto4 "https://github.com/seungineer/modoocoin-java/blob/main/src/client/dto/UserProfileDTO.java"
    click tradingService "https://github.com/seungineer/modoocoin-java/blob/main/src/client/service/TradingService.java"
    click userService "https://github.com/seungineer/modoocoin-java/blob/main/src/client/service/UserService.java"
    click clientTest "https://github.com/seungineer/modoocoin-java/tree/main/src/client/test"
    click displayClient "https://github.com/seungineer/modoocoin-java/blob/main/src/display/DisplayClient.java"
    click coinListHandler "https://github.com/seungineer/modoocoin-java/blob/main/src/display/component/CoinListHandler.java"
    click coinDTO "https://github.com/seungineer/modoocoin-java/blob/main/src/display/dto/Coin.java"
    click coinType "https://github.com/seungineer/modoocoin-java/blob/main/src/display/type/CoinType.java"
    click jsonParser "https://github.com/seungineer/modoocoin-java/blob/main/src/display/utils/JsonParser.java"
    click serverMain "https://github.com/seungineer/modoocoin-java/blob/main/src/server/Main.java"
    click clientHandler "https://github.com/seungineer/modoocoin-java/blob/main/src/server/Handler/ClientHandler.java"
    click wsClient "https://github.com/seungineer/modoocoin-java/blob/main/src/server/Handler/UpbitWebSocketClient.java"

    %% Styles
    classDef client fill:#e6f9ff,stroke:#333,stroke-width:2px;
    classDef server fill:#ffe6e6,stroke:#333,stroke-width:2px;
    classDef display fill:#e6ffe6,stroke:#333,stroke-width:2px;
    classDef external fill:#ffffe6,stroke:#333,stroke-width:2px;
```
