# parkjto/ige architecture

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

- Interactive diagram: https://gitdiagram.com/parkjto/ige
- Repository: https://github.com/parkjto/ige

## Overview

##### Project type and purpose
- This is a full-stack web application (“IgE”) providing food allergy information, personalized menu recommendations, and restaurant location guides.
- The backend is a Spring Boot monolith exposing REST APIs; the frontend is a React SPA consuming those APIs and embedding map services.

##### File structure
- Top-level: build scripts (Gradle), README, .env
- src/main/java/com/SW/IgE: Spring Boot code organized in controller, service, repository, entity, converter, security, exception, util
- src/main/frontend: typical React structure (public, src/pages, components, CSS modules) plus setupProxy.js for API proxying
- src/main/resources: application.properties, data.sql
- External service clients configured via RestTemplateConfig and NaverSearchService
- Tests in src/test/java

##### Key architectural patterns and design principles
- Layered (Controller → Service → Repository → Database)
- MVC flavor on backend (controllers handle HTTP, services handle business logic, repositories handle persistence)
- Single-page application front-end communicating over REST
- Dependency injection (Spring) and modular React components
- Separation of concerns: allergy data retrieval vs. menu logic vs. user management vs. map integration

##### Main components and interactions
a. Frontend (React.js SPA)
- UI components & pages (Login, Join, Main, Search, MapComponent, RandomMenu, etc.)
- HTTP client (fetch/axios via setupProxy) to backend
- Widget invoking Kakao Map API in MapComponent; custom hooks call navigator.geolocation
b. Backend (Spring Boot)
- REST controllers (UserController, MenuController, InformController, MServerController) expose endpoints under `/api/*`
- Services implement business rules (UserService, MenuService, InformService, NaverSearchService)
- Repositories (JPA) persist entities (User, Menu, Inform)
- Security layer (SecurityConfig, CustomUserDetails, UserDetailsServiceImpl) for authentication & authorization
- RestTemplateConfig for external API calls (Naver Local Search)
c. Database
- Relational database (MySQL/H2) storing users, menu items, allergy info (initialized via data.sql)
d. External Services
- Kakao Map API for map rendering
- Naver Local Search API for restaurant lookup
e. (Optional) Caching or async tasks—none found here

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend Layer
    subgraph "Frontend (SPA)"
        direction TB
        SPA["React SPA"]:::frontend
        Pages["React Pages"]:::frontend
        Proxy["HTTP Proxy (setupProxy.js)"]:::frontend
        MapComp["MapComponent"]:::frontend
        GeoHook1["useCurrentLocation"]:::frontend
        GeoHook2["useLocationTest"]:::frontend
        SearchHook["useSearch"]:::frontend
    end

    %% Backend Layer
    subgraph "Spring Boot Application"
        direction TB
        App["IgEApplication"]:::backend

        subgraph "Controllers"
            direction TB
            UserCtrl["UserController"]:::backend
            MenuCtrl["MenuController"]:::backend
            InformCtrl["InformController"]:::backend
            MServerCtrl["MServerController"]:::backend
        end

        subgraph "Services"
            direction TB
            UserService["UserService"]:::backend
            MenuService["MenuService"]:::backend
            InformService["InformService"]:::backend
            NaverService["NaverSearchService"]:::backend
            UserDetailsService["UserDetailsServiceImpl"]:::backend
        end

        subgraph "Repositories"
            direction TB
            UserRepo["UserRepository"]:::backend
            MenuRepo["MenuRepository"]:::backend
            InformRepo["InformRepository"]:::backend
        end

        subgraph "Domain & Utils"
            direction TB
            Entities["Entities & DTOs"]:::backend
            Converters["Converters & Utils"]:::backend
        end

        subgraph "Security & Exception"
            direction TB
            SecurityCfg["SecurityConfig"]:::backend
            CustomUD["CustomUserDetails"]:::backend
            GlobalEx["GlobalExceptionHandler"]:::backend
            UserNotFoundEx["UserNotFoundException"]:::backend
        end

        RestCfg["RestTemplateConfig"]:::backend
    end

    %% Database
    DB[(Database)]:::db

    %% External Services
    Kakao["Kakao Map API"]:::external
    NaverAPI["Naver Local Search API"]:::external

    %% Connections
    SPA -->|"HTTP/HTTPS"| UserCtrl
    Pages --> UserCtrl
    MapComp -->|loads SDK| Kakao
    MapComp --> GeoHook1
    MapComp --> GeoHook2
    Pages --> SearchHook
    SearchHook -->|calls| Proxy
    Proxy -->|forwards to| App

    UserCtrl -->|uses| UserService
    MenuCtrl -->|uses| MenuService
    InformCtrl -->|uses| InformService
    MServerCtrl -->|uses| NaverService

    UserService -->|CRUD| UserRepo
    MenuService -->|CRUD| MenuRepo
    InformService -->|CRUD| InformRepo

    UserRepo -->|JDBC/ORM| DB
    MenuRepo -->|JDBC/ORM| DB
    InformRepo -->|JDBC/ORM| DB

    NaverService -->|REST| NaverAPI
    UserDetailsService -->|integrates with| SecurityCfg
    RestCfg -->|provides RestTemplate| NaverService

    App --> UserCtrl
    App --> MenuCtrl
    App --> InformCtrl
    App --> MServerCtrl
    App --> RestCfg
    App --> SecurityCfg

    %% Click Events Frontend
    click SPA "https://github.com/parkjto/ige/tree/master/src/main/frontend"
    click Pages "https://github.com/parkjto/ige/tree/master/src/main/frontend/src/pages"
    click Proxy "https://github.com/parkjto/ige/blob/master/src/main/frontend/src/setupProxy.js"
    click MapComp "https://github.com/parkjto/ige/blob/master/src/main/frontend/src/pages/MapComponent.js"
    click GeoHook1 "https://github.com/parkjto/ige/blob/master/src/main/frontend/src/pages/useCurrentLocation.js"
    click GeoHook2 "https://github.com/parkjto/ige/blob/master/src/main/frontend/src/pages/useLocationTest.js"
    click SearchHook "https://github.com/parkjto/ige/blob/master/src/main/frontend/src/pages/useSearch.js"

    %% Click Events Backend
    click App "https://github.com/parkjto/ige/blob/master/src/main/java/com/SW/IgE/IgEApplication.java"
    click UserCtrl "https://github.com/parkjto/ige/blob/master/src/main/java/com/SW/IgE/controller/UserController.java"
    click MenuCtrl "https://github.com/parkjto/ige/blob/master/src/main/java/com/SW/IgE/controller/MenuController.java"
    click InformCtrl "https://github.com/parkjto/ige/blob/master/src/main/java/com/SW/IgE/controller/InformController.java"
    click MServerCtrl "https://github.com/parkjto/ige/blob/master/src/main/java/com/SW/IgE/controller/MServerController.java"
    click UserService "https://github.com/parkjto/ige/blob/master/src/main/java/com/SW/IgE/service/UserService.java"
    click MenuService "https://github.com/parkjto/ige/blob/master/src/main/java/com/SW/IgE/service/MenuService.java"
    click InformService "https://github.com/parkjto/ige/blob/master/src/main/java/com/SW/IgE/service/InformService.java"
    click NaverService "https://github.com/parkjto/ige/blob/master/src/main/java/com/SW/IgE/service/NaverSearchService.java"
    click UserDetailsService "https://github.com/parkjto/ige/blob/master/src/main/java/com/SW/IgE/service/UserDetailsServiceImpl.java"
    click UserRepo "https://github.com/parkjto/ige/blob/master/src/main/java/com/SW/IgE/repository/UserRepository.java"
    click MenuRepo "https://github.com/parkjto/ige/blob/master/src/main/java/com/SW/IgE/repository/MenuRepository.java"
    click InformRepo "https://github.com/parkjto/ige/blob/master/src/main/java/com/SW/IgE/repository/InformRepository.java"
    click RestCfg "https://github.com/parkjto/ige/blob/master/src/main/java/com/SW/IgE/RestTemplateConfig.java"

    %% Click for Security & Exception
    click SecurityCfg "https://github.com/parkjto/ige/blob/master/src/main/java/com/SW/IgE/security/SecurityConfig.java"
    click CustomUD "https://github.com/parkjto/ige/blob/master/src/main/java/com/SW/IgE/security/CustomUserDetails.java"
    click GlobalEx "https://github.com/parkjto/ige/blob/master/src/main/java/com/SW/IgE/exception/GlobalExceptionHandler.java"
    click UserNotFoundEx "https://github.com/parkjto/ige/blob/master/src/main/java/com/SW/IgE/exception/UserNotFoundException.java"

    %% Click for Domain & Utils
    click Entities "https://github.com/parkjto/ige/blob/master/src/main/java/com/SW/IgE/entity/User.java"
    click Converters "https://github.com/parkjto/ige/blob/master/src/main/java/com/SW/IgE/converter/IngredientsConverter.java"

    %% Styles
    classDef frontend fill:#cce5ff,stroke:#3399ff,color:#000;
    classDef backend fill:#d4edda,stroke:#28a745,color:#000;
    classDef db fill:#ffe5b4,stroke:#ff8c00,color:#000;
    classDef external fill:#e2d5f3,stroke:#8000ff,color:#000;
```
