# goosebbeoms/sogoo architecture

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

- Interactive diagram: https://gitdiagram.com/goosebbeoms/sogoo
- Repository: https://github.com/goosebbeoms/sogoo

## Overview

##### Project type and purpose
- This is a full-stack subscription-platform application (“SOGOO”) composed of:
– A React/Vite-based frontend served behind NGINX
– A Spring Boot “config” microservice (Spring Cloud Config Server)
– A Spring Boot “main” microservice (the core API)
– An AI microservice (FastAPI-based KoBERT model for review analysis)
– Supporting infrastructure: PostgreSQL, Redis, Elasticsearch, AWS S3, external payment gateway (TossPayments).

##### File structure
- Top level:
– ai/ → Jupyter notebooks and a FastAPI app for NLP (review summarization)
– backend/config/ → Spring Cloud Config Server project
– backend/main/ → Spring Boot main application project (domain modules, security, AWS S3, JWT, Quartz schedulers)
– frontend/ → Vite/React UI, Tailwind, React Query, Zustand state management, Axios configs
– docker-compose.*.yml → separate compose files for config service, main service, frontend
– docs/ → API specs, ERD, architecture docs
- Patterns:
– Microservice separation (config vs. main vs. AI)
– Layered MVC within the main service (controllers → services → repositories → entities)
– External integrations managed via dedicated “client” classes (e.g. TossPaymentsClient, ChatClientConfig)

##### README for additional insights
- Purpose: connect small-business owners with subscription customers
- Key features: subscription design, dashboard analytics, review-based sentiment analysis, search & recommendation
- Tech stack confirms use of Spring Cloud Config, Redis caching, PostgreSQL, Elasticsearch, AWS S3, JWT, FastAPI/KoBERT

a. Main components:
– Users (Buyer, Seller) via browser/mobile
– Frontend (React app behind NGINX)
– API Gateway / Load Balancer (NGINX)
– Config Service (Spring Cloud Config)
– Main Service (Spring Boot)
– AI Service (FastAPI KoBERT)
– Datastores: PostgreSQL, Redis, Elasticsearch
– File storage: AWS S3
– External Payment Gateway (TossPayments)
– CI/CD pipeline: Jenkins → Docker images → AWS EC2

b. Relationships & interactions:
– Browser → NGINX → React frontend
– React → REST calls → Main Service
– Main Service on startup fetches config from Config Service
– Main Service → reads/writes to PostgreSQL, caches to Redis, indexes/searches in Elasticsearch, stores images/files in S3
– Main Service → invokes AI Service (review analysis) via HTTP
– Main Service → invokes TossPayments API for payment processing
– CI/CD: GitLab/Jenkins pipelines build Docker images, push to registry, deploy to EC2 via Docker Compose

c. Architectural patterns & principles:
– Twelve-factor app style (externalized config via Config Server)
– Layered architecture in main service (Controller → Service → Repository)
– Microservices for separation of concerns (config, main, AI)
– Event-driven scheduling (Quartz jobs for automatic billing)
– Caching layer (Redis) for performance
– Search microservice (Elasticsearch) for text-based search
– JWT-based stateless authentication

d. Key technologies & frameworks (annotate each component)
– Frontend: React 18, Vite, TypeScript, Tailwind, React Query, Zustand
– Config Service: Spring Boot 3.3.1, Spring Cloud Config
– Main Service: Spring Boot, Spring Data JPA, Spring Security, JWT, AWS S3 SDK, Quartz, Redis, PostgreSQL, Elasticsearch
– AI Service: FastAPI, KoBERT model
– CI/CD: Jenkins, Docker, Docker Compose, NGINX, AWS EC2

##### Detail & granularity
- Sub-component where it matters (e.g., “Elasticsearch Indexer” inside Main Service)
- Don’t over-aggregate—show all four services (frontend, config, main, AI) separately
- Schedulers and external integrations as distinct nodes

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% UI Layer
    subgraph "UI Layer"
        direction TB
        Users["Users (Buyer/Seller)"]:::external
        Nginx["NGINX (Load Balancer)"]:::infra
        Frontend["React/Vite Frontend"]:::frontend
    end

    %% API Layer
    subgraph "API Layer"
        direction TB
        ConfigService["Spring Cloud Config Service"]:::config
        MainService["Spring Boot Main Service"]:::backend
        AIService["FastAPI KoBERT AI Service"]:::ai
    end

    %% Data Layer
    subgraph "Data Layer"
        direction TB
        Postgres["PostgreSQL"]:::db
        RedisCache["Redis Cache"]:::db
        Elasticsearch["Elasticsearch"]:::db
        S3["AWS S3"]:::external
    end

    %% External & Infra
    subgraph "External & Infra"
        direction TB
        PaymentGateway["TossPayments Gateway"]:::external
        Docs["Documentation (API, ERD, Arch)"]:::infra
    end

    %% CI/CD
    subgraph "CI/CD Pipeline"
        direction TB
        Jenkins["Jenkins CI"]:::infra
        DockerRegistry["Docker Registry"]:::infra
        EC2["AWS EC2"]:::infra
    end

    %% Connections
    Users -->|"HTTP Request"| Nginx
    Nginx -->|"Serves UI"| Frontend
    Frontend -->|"REST Calls"| MainService
    MainService -->|"Fetch Config"| ConfigService
    MainService -->|"Read/Write"| Postgres
    MainService -->|"Cache"| RedisCache
    MainService -->|"Index/Search"| Elasticsearch
    MainService -->|"Store Files"| S3
    MainService -->|"Invoke"| AIService
    MainService -->|"Process Payment"| PaymentGateway
    MainService -.->|"Scheduled Billing"| QuartzJobs["Quartz Scheduler"]:::backend
    QuartzJobs -->|"Triggers Jobs"| MainService
    Jenkins -->|"Build Images"| DockerRegistry
    DockerRegistry -->|"Deploy via Compose"| EC2
    EC2 -->|"Hosts Services"| Nginx

    %% Click Events
    click Frontend "https://github.com/goosebbeoms/sogoo/tree/master/frontend/"
    click ConfigService "https://github.com/goosebbeoms/sogoo/tree/master/backend/config/"
    click MainService "https://github.com/goosebbeoms/sogoo/tree/master/backend/main/"
    click AIService "https://github.com/goosebbeoms/sogoo/tree/master/ai/app/"
    click Postgres "https://github.com/goosebbeoms/sogoo/blob/master/docker-compose.be-main.yml"
    click RedisCache "https://github.com/goosebbeoms/sogoo/blob/master/backend/main/src/main/java/com/ssafy/c107/main/common/config/RedisConfig.java"
    click Elasticsearch "https://github.com/goosebbeoms/sogoo/blob/master/backend/main/src/main/java/com/ssafy/c107/main/common/config/ElasticSearchConfig.java"
    click S3 "https://github.com/goosebbeoms/sogoo/blob/master/backend/main/src/main/java/com/ssafy/c107/main/common/aws/S3Config.java"
    click QuartzJobs "https://github.com/goosebbeoms/sogoo/blob/master/backend/main/src/main/java/com/ssafy/c107/main/domain/pay/quartz/QuartzConfig.java"
    click PaymentGateway "https://github.com/goosebbeoms/sogoo/blob/master/backend/main/src/main/java/com/ssafy/c107/main/domain/pay/client/TossPaymentsClient.java"
    click Jenkins "https://github.com/goosebbeoms/sogoo/blob/master/docker-compose.be-config.yml"
    click DockerRegistry "https://github.com/goosebbeoms/sogoo/blob/master/docker-compose.be-main.yml"
    click EC2 "https://github.com/goosebbeoms/sogoo/blob/master/docker-compose.frontend.yml"
    click Docs "https://github.com/goosebbeoms/sogoo/tree/master/docs/"

    %% Styles
    classDef frontend fill:#f9f,stroke:#333,stroke-width:1px
    classDef backend fill:#bbf,stroke:#333,stroke-width:1px
    classDef config fill:#bfb,stroke:#333,stroke-width:1px
    classDef ai fill:#fbf,stroke:#333,stroke-width:1px
    classDef db fill:#ffe,stroke:#333,stroke-width:1px
    classDef external fill:#fdd,stroke:#333,stroke-width:1px
    classDef infra fill:#ddd,stroke:#333,stroke-width:1px
```
