# ezzanzzan/2023-dong-gle architecture

> Architecture diagram of the GitHub repository ezzanzzan/2023-dong-gle, 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/ezzanzzan/2023-dong-gle
- Repository: https://github.com/ezzanzzan/2023-dong-gle

## Overview

##### Project Type and Purpose
- This is a full-stack web application called “Donggle” that allows users to write or import text editor content and publish it to various blogging platforms (Tistory, Medium, Notion).
- The backend is a single Spring Boot monolith exposing REST APIs. The frontend is a TypeScript React SPA served through Nginx.
- It integrates with several external APIs for publishing and OAuth and uses AWS for file storage.

##### File-Structure Analysis
- Top level contains two main folders: backend and frontend, plus Docker Compose and Nginx configs under conf-dev, conf-prod, and compose-*.yml.
- Backend follows a layered MVC approach:
- ui (REST controllers)
- application (use-case services, request/response DTOs, client abstractions)
- domain (entities, value objects, parsers, renderers)
- infrastructure (HTTP clients for external services, S3 file handler, OAuth clients)
- repository (Spring Data JPA interfaces)
- config (environment, dev/test data initialization)
- exception (authentication, business, not-found)
- tests mirror each layer.
- Frontend is a React SPA with:
- routers & pages
- shared components (common controls, category, writing, publishing sections)
- API wrappers under apis/*.ts
- global state & React Contexts
- Cypress for E2E tests and Jest for unit tests
- Webpack/Docker config for builds.
- Infrastructure: multiple Dockerfiles (front/back), blue‐green compose files, Nginx templates, deploy.sh script.

##### README Insights
- Confirms the tech stack: AWS RDS (MySQL), Redis, S3, Spring Boot, React, TypeScript.

a. Main Components
- User’s Web Browser (SPA)
- Front-end Nginx (Docker / AWS ALB)
- React Application (served by Nginx)
- API Gateway / Back-end Nginx (routes to Spring Boot)
- Spring Boot Service (controllers, services, repositories)
- MySQL Database (RDS)
- Redis Cache
- S3 Bucket (for media uploads)
- External API Services: Notion API, Medium API, Tistory API, Kakao OAuth
- Blue-Green Deployment Env (two application sets, traffic switcher)
b. Relationships & Interactions
- Browser → HTTP over TLS → Front-end Nginx → React assets
- React → REST calls → Back-end Nginx → Spring Boot controllers
- Controllers → Application services → Repositories → MySQL
- Controllers / Services → Redis (caching tokens, sessions)
- File upload/download endpoints → S3 client (presigned URLs)
- Publishing Service → External blog APIs (HTTP clients)
- OAuth flow → Kakao API → Back-end authentication service
- Blue-Green deployer switches Nginx upstreams between two Spring Boot sets.
c. Architectural Patterns & Principles
- Layered (MVC + service + repository) architecture in backend
- Aspect-oriented concurrency control (NoConcurrentExecution)
- Parser / Renderer modules separate content transformation from I/O
- API wrappers isolate external service contracts
- Single-page application with API boundary
- Blue-Green deployment for zero downtime
d. Key Technologies
- Java + Spring Boot (Gradle), Spring Data JPA, Spring AOP
- React + TypeScript, Webpack, MSW (mock Service Worker), Cypress
- Docker & Docker Compose, Nginx, AWS RDS, ElastiCache Redis, S3

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% User Interaction
    User["User Browser"]:::external
    User -->|"HTTPS"| FE_NGINX

    %% Front-end Layer
    subgraph "Front-end Layer"
        direction TB
        FE_NGINX["Nginx (Frontend)"]:::infra
        ReactApp["React SPA"]:::frontend
        FE_NGINX --> ReactApp
        ReactApp -->|"REST API Calls"| BE_NGINX
    end

    %% Back-end Layer Entry
    subgraph "Back-end Layer"
        direction TB
        BE_NGINX["Nginx (API Gateway)"]:::infra
        SpringBoot["Spring Boot Service"]:::backend
        BE_NGINX --> SpringBoot

        %% Spring Boot Internal Layers
        subgraph "Spring Boot Service"
            direction TB
            Entry["DonggleApplication (Entry Point)"]:::backend
            Controllers["UI Layer (Controllers)"]:::backend
            Services["Application Services"]:::backend
            Domain["Domain Model"]:::backend
            Repos["Repository Interfaces"]:::backend
            InfraClients["Infrastructure Clients"]:::backend
            S3Client["S3 Upload Client"]:::infra
            OAuthClients["OAuth Kakao Clients"]:::infra
            Configs["Configuration"]:::backend
            Exceptions["Exception Handling"]:::backend

            Entry --> Controllers
            Controllers --> Services
            Services --> Domain
            Services --> Repos
            Services --> InfraClients
            InfraClients --> S3Client
            InfraClients --> OAuthClients
            Entry --> Configs
            Entry --> Exceptions
        end
    end

    %% Data Stores
    subgraph "Datastores"
        direction TB
        MySQL["MySQL (RDS)"]:::db
        Redis["Redis Cache"]:::cache
        S3["S3 Bucket"]:::storage
    end

    SpringBoot -->|JPA| MySQL
    SpringBoot -->|Cache| Redis
    SpringBoot -->|Presigned URLs| S3

    %% External Services
    subgraph "External APIs"
        direction TB
        Notion["Notion API"]:::external
        Medium["Medium API"]:::external
        Tistory["Tistory API"]:::external
        Kakao["Kakao OAuth API"]:::external
    end

    SpringBoot -->|Publish| Notion
    SpringBoot -->|Publish| Medium
    SpringBoot -->|Publish| Tistory
    SpringBoot -->|OAuth Flow| Kakao

    %% Deployment / Blue-Green
    subgraph "Blue-Green Deployment"
        direction TB
        BG_NGINX["Nginx Upstream Switcher"]:::infra
        BG_BLUE["Spring Boot (Blue)"]:::backend
        BG_GREEN["Spring Boot (Green)"]:::backend
        BG_NGINX --> BG_BLUE
        BG_NGINX --> BG_GREEN
        BE_NGINX --> BG_NGINX
    end

    %% Click Events
    click Entry "https://github.com/ezzanzzan/2023-dong-gle/blob/develop/backend/src/main/java/org/donggle/backend/DonggleApplication.java"
    click Controllers "https://github.com/ezzanzzan/2023-dong-gle/tree/develop/backend/src/main/java/org/donggle/backend/ui"
    click Services "https://github.com/ezzanzzan/2023-dong-gle/tree/develop/backend/src/main/java/org/donggle/backend/application/service"
    click Repos "https://github.com/ezzanzzan/2023-dong-gle/tree/develop/backend/src/main/java/org/donggle/backend/application/repository"
    click Domain "https://github.com/ezzanzzan/2023-dong-gle/tree/develop/backend/src/main/java/org/donggle/backend/domain"
    click InfraClients "https://github.com/ezzanzzan/2023-dong-gle/tree/develop/backend/src/main/java/org/donggle/backend/infrastructure/client"
    click S3Client "https://github.com/ezzanzzan/2023-dong-gle/blob/develop/backend/src/main/java/org/donggle/backend/infrastructure/file/S3UploadClient.java"
    click OAuthClients "https://github.com/ezzanzzan/2023-dong-gle/tree/develop/backend/src/main/java/org/donggle/backend/infrastructure/oauth/kakao"
    click Configs "https://github.com/ezzanzzan/2023-dong-gle/tree/develop/backend/src/main/java/org/donggle/backend/config"
    click Exceptions "https://github.com/ezzanzzan/2023-dong-gle/tree/develop/backend/src/main/java/org/donggle/backend/exception"
    click FE_NGINX "https://github.com/ezzanzzan/2023-dong-gle/blob/develop/frontend/default.conf"
    click ReactApp "https://github.com/ezzanzzan/2023-dong-gle/blob/develop/frontend/src/App.tsx"
    click BG_NGINX "https://github.com/ezzanzzan/2023-dong-gle/blob/develop/compose-nginx.yml"
    click BG_BLUE "https://github.com/ezzanzzan/2023-dong-gle/blob/develop/compose-blue.yml"
    click BG_GREEN "https://github.com/ezzanzzan/2023-dong-gle/blob/develop/compose-green.yml"

    %% Styles
    classDef frontend fill:#f9f,stroke:#333,stroke-width:1px;
    classDef backend fill:#bbf,stroke:#333,stroke-width:1px;
    classDef db fill:#bfb,stroke:#333,stroke-width:1px;
    classDef cache fill:#ffb,stroke:#333,stroke-width:1px;
    classDef storage fill:#fbf,stroke:#333,stroke-width:1px;
    classDef external fill:#eee,stroke:#666,stroke-width:1px,stroke-dasharray: 5 5;
    classDef infra fill:#ffd,stroke:#333,stroke-width:1px;
```
