# bongsangkim/mijung architecture

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

- Interactive diagram: https://gitdiagram.com/bongsangkim/mijung
- Repository: https://github.com/bongsangkim/mijung

## Overview

##### Project type and purpose
- This is a full-stack, data-driven web application (“미정(味定)”) providing ingredient price trends, related ingredients, and recipe recommendations.
- It combines a React-based frontend, two backend services (Java/Spring Boot and Python/FastAPI), a MySQL database, big-data analysis (Hadoop/Spark), and CI/CD (Docker, Jenkins, Nginx, AWS).

##### File structure
Top-level directories:
- analysis: Python scripts & Jupyter notebooks for time-series forecasting (ARIMA, LSTM, Prophet), word2vec embedding, FPGrowth, data preprocessing.
- backend: Java/Spring Boot project (controllers, services, repositories) exposing REST APIs for ingredients, recipes, carts.
- fastapi: Python FastAPI microservice handling embedding, cosine similarity, scheduling jobs with APScheduler.
- frontend: React/TypeScript SPA (Zustand, Tanstack Query, D3.js/Sigma.js), static assets, routing, components.
- exec: Dockerfiles and docker-compose for backend, FastAPI, Jenkins, Nginx; certbot folder for SSL.
- hadoop: scripts and README for setting up Hadoop/Spark cluster.
- jenkins, nginx, docker-compose.yml: CI/CD pipelines and reverse-proxy configuration.

##### README insights
- Technology stack: React/Tailwind, Java Spring Boot, Python (data & FastAPI), MySQL, Hadoop/Spark, Docker, Jenkins, Nginx, AWS EC2.
- Features: time-series analysis, network graph (cosine similarity), association rules (FPGrowth), scheduled jobs, CI/CD.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% User and Clients
    User["User / Browser"]:::frontend

    %% Infrastructure
    subgraph "AWS EC2 Environment"
        direction TB
        subgraph "Docker Host"
            direction TB
            Nginx["Nginx Reverse Proxy\n(SSL via Certbot)"]:::infra
            Frontend["React SPA"]:::frontend
            JavaAPI["Spring Boot API"]:::api
            FastAPIService["FastAPI Recommendation Service"]:::api
            MySQLDB[(MySQL Database)]:::db
        end
        Jenkins["Jenkins CI/CD"]:::infra
    end

    %% Analytics Cluster
    subgraph "Hadoop/Spark Cluster"
        direction TB
        HDFS["HDFS Storage"]:::analytics
        SparkNodes["Spark Nodes"]:::analytics
    end

    %% Data Analysis Scripts
    analysisScripts["Analysis Scripts"]:::analytics

    %% User Flow
    User -->|HTTPS| Nginx
    Nginx -->|Serves SPA| Frontend
    Frontend -->|REST /ingredients, /recipes| JavaAPI
    Frontend -->|REST /recommend| FastAPIService
    JavaAPI -->|JDBC| MySQLDB
    FastAPIService -->|PyMySQL| MySQLDB

    %% Data Pipeline
    analysisScripts -->|Batch → HDFS/Local| HDFS
    HDFS -->|Input CSVs| SparkNodes
    SparkNodes -->|Models & Metrics| MySQLDB
    FastAPIService -->|Scheduler pulls models| analysisScripts

    %% CI/CD Pipeline
    Jenkins -->|Build & Deploy Containers| Nginx

    %% Legend
    subgraph Legend
        direction TB
        L1["Blue: Frontend"]:::frontend
        L2["Green: APIs"]:::api
        L3["Orange: Analytics"]:::analytics
        L4["Gray: Infrastructure"]:::infra
    end

    %% Click Events
    click Frontend "https://github.com/bongsangkim/mijung/tree/dev/frontend/"
    click Frontend "https://github.com/bongsangkim/mijung/blob/dev/frontend/src/app/App.tsx"
    click JavaAPI "https://github.com/bongsangkim/mijung/blob/dev/backend/mijung/src/main/java/com/example/mijung/MijungApplication.java"
    click FastAPIService "https://github.com/bongsangkim/mijung/blob/dev/fastapi/app/main.py"
    click analysisScripts "https://github.com/bongsangkim/mijung/blob/dev/analysis/시계열분석/analysis_ARIMA.py"
    click HDFS "https://github.com/bongsangkim/mijung/blob/dev/hadoop/README.md"
    click Jenkins "https://github.com/bongsangkim/mijung/tree/dev/exec/jenkins/Jenkinsfile"

    %% Styles
    classDef frontend fill:#add8e6,stroke:#000
    classDef api fill:#90ee90,stroke:#000
    classDef analytics fill:#ffa500,stroke:#000
    classDef infra fill:#d3d3d3,stroke:#000
    classDef db fill:#ffd700,stroke:#000
```
