# yebinnnnn/mulcammatmap-be architecture

> Architecture diagram of the GitHub repository yebinnnnn/mulcammatmap-be, 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/yebinnnnn/mulcammatmap-be
- Repository: https://github.com/yebinnnnn/mulcammatmap-be

## Overview

##### Project Type and Purpose
- Project type: A backend RESTful microservice (Spring Boot) providing restaurant-review functionality, JWT-secured endpoints, Slack integration, and geocoding via Naver’s API.
- Purpose: Expose endpoints for member auth, restaurant CRUD, reviews/comments, and handle Slack events; persist data to a relational database; enrich data with external geocoding.

##### High-Level Components
A. Clients
– Web/Mobile front end (consumers of the REST API)
– Slack (incoming slash commands or event subscriptions)
B. API Gateway / HTTP Layer
– Spring Security Filter Chain (CorsConfig, JwtAuthenticationFilter)
C. Application Core (Spring Boot)
1. Controllers (AuthController, RestaurantController, CommentController, ReviewController, SlackController, SlackEventController)
2. Services (MemberService, RestaurantService, CommentService, ReviewService, SlackService, GeocodingService)
3. Data Access Layer
– Repositories (Spring Data JPA): MemberRepository, RestaurantRepository, CommentRepository, ReviewRepository, etc.
– Entities (Member, Restaurant, Review, Comment, Category, CategoryRestaurant)
4. Configuration
– JWTTokenProvider, SecurityConfig, RestTemplateConfig, SwaggerConfig, AdminConfig, DataLoader
D. External Systems
– Naver Geocoding API (via RestTemplate)
– Slack API (incoming webhooks & event responses)
E. Database
– Relational DB (e.g. PostgreSQL/MySQL) accessed via JPA/Hibernate
F. Infrastructure / Deployment
– Docker/Kubernetes (not in repo, but include if used)
– Profiles: application-dev.yml vs application-prod.yml

##### Relationships and Data Flows
- From Controllers → Services (business logic).
- From Services → Repositories → Database (CRUD).
- From GeocodingService → Naver Geocoding API (external HTTP call).
- From SlackController/EventController → SlackService → Slack API (outgoing).
- Within the HTTP layer, show SecurityConfig enforcing JWT via JwtAuthenticationFilter.

##### Architectural Patterns & Design Principles
- Layered (Presentation → Business → Persistence).
- Dependency Injection (Spring beans).
- Single Responsibility per layer: Controllers orchestrate, Services implement business rules, Repositories handle ORM.
- External APIs encapsulated in their own services (GeocodingService, SlackService).
- Configs centralized under src/main/java/.../config.

##### Technologies & Frameworks
- Java 17+ with Spring Boot
- Spring MVC (REST controllers)
- Spring Security (JWT auth)
- Spring Data JPA / Hibernate
- Swagger (SwaggerConfig)
- RestTemplate (RestTemplateConfig)
- Gradle build system
- YAML profiles for dev/prod

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Clients
    subgraph "Clients"
        direction TB
        WebMobile["Web/Mobile"]:::external
        SlackClient["Slack"]:::external
    end

    %% API Gateway / HTTP Layer
    subgraph "API Gateway / HTTP Layer"
        direction TB
        SecurityConfig["SecurityConfig"]:::config
        CorsConfig["CorsConfig"]:::config
        JwtAuthFilter["JwtAuthenticationFilter"]:::config
        JwtTokenProvider["JwtTokenProvider"]:::config
    end

    %% Controllers Layer
    subgraph "Controllers" 
        direction TB
        AuthController["AuthController"]:::controllers
        RestaurantController["RestaurantController"]:::controllers
        CommentController["CommentController"]:::controllers
        ReviewController["ReviewController"]:::controllers
        SlackController["SlackController"]:::controllers
        SlackEventController["SlackEventController"]:::controllers
    end

    %% Services Layer
    subgraph "Services"
        direction TB
        MemberService["MemberService"]:::services
        RestaurantService["RestaurantService"]:::services
        CommentService["CommentService"]:::services
        ReviewService["ReviewService"]:::services
        SlackService["SlackService"]:::services
        GeocodingService["GeocodingService"]:::services
    end

    %% Data Access Layer
    subgraph "Data Access Layer"
        direction TB
        MemberRepo["MemberRepository"]:::repositories
        RestaurantRepo["RestaurantRepository"]:::repositories
        CommentRepo["CommentRepository"]:::repositories
        ReviewRepo["ReviewRepository"]:::repositories
        CategoryRepo["CategoryRepository"]:::repositories
        CatRestRepo["CategoryRestaurantRepository"]:::repositories
        Database["Relational Database"]:::database
    end

    %% Configuration & Startup
    subgraph "Configuration & Startup"
        direction TB
        SwaggerConfig["SwaggerConfig"]:::config
        RestTemplateConfig["RestTemplateConfig"]:::config
        AdminConfig["AdminConfig"]:::config
        DataLoader["DataLoader"]:::config
    end

    %% External Systems
    subgraph "External Systems"
        direction TB
        NaverAPI["Naver Geocoding API"]:::external
        SlackAPI["Slack API"]:::external
    end

    %% Flows
    WebMobile -->|HTTP request| SecurityConfig
    SlackClient -->|Event/Command| SecurityConfig
    SecurityConfig --> CorsConfig
    CorsConfig --> JwtAuthFilter
    JwtAuthFilter --> JwtTokenProvider
    JwtTokenProvider --> AuthController

    AuthController --> MemberService
    RestaurantController --> RestaurantService
    CommentController --> CommentService
    ReviewController --> ReviewService
    SlackController --> SlackService
    SlackEventController --> SlackService

    MemberService --> MemberRepo
    RestaurantService --> RestaurantRepo
    CommentService --> CommentRepo
    ReviewService --> ReviewRepo
    RestaurantService --> CategoryRepo
    RestaurantService --> CatRestRepo

    MemberRepo --> Database
    RestaurantRepo --> Database
    CommentRepo --> Database
    ReviewRepo --> Database
    CategoryRepo --> Database
    CatRestRepo --> Database

    GeocodingService --> NaverAPI
    SlackService --> SlackAPI

    RestTemplateConfig --> GeocodingService
    RestTemplateConfig --> SlackService
    DataLoader --> RestaurantRepo
    DataLoader --> CategoryRepo
    DataLoader --> CatRestRepo

    %% Click Events
    click MultiMatMapApplication "https://github.com/yebinnnnn/mulcammatmap-be/blob/dev/src/main/java/com/example/multimatmap/MultiMatMapApplication.java"
    click AdminConfig "https://github.com/yebinnnnn/mulcammatmap-be/blob/dev/src/main/java/com/example/multimatmap/config/AdminConfig.java"
    click CorsConfig "https://github.com/yebinnnnn/mulcammatmap-be/blob/dev/src/main/java/com/example/multimatmap/config/CorsConfig.java"
    click DataLoader "https://github.com/yebinnnnn/mulcammatmap-be/blob/dev/src/main/java/com/example/multimatmap/config/DataLoader.java"
    click JwtAuthFilter "https://github.com/yebinnnnn/mulcammatmap-be/blob/dev/src/main/java/com/example/multimatmap/config/JwtAuthenticationFilter.java"
    click JwtTokenProvider "https://github.com/yebinnnnn/mulcammatmap-be/blob/dev/src/main/java/com/example/multimatmap/config/JwtTokenProvider.java"
    click RestTemplateConfig "https://github.com/yebinnnnn/mulcammatmap-be/blob/dev/src/main/java/com/example/multimatmap/config/RestTemplateConfig.java"
    click SecurityConfig "https://github.com/yebinnnnn/mulcammatmap-be/blob/dev/src/main/java/com/example/multimatmap/config/SecurityConfig.java"
    click SwaggerConfig "https://github.com/yebinnnnn/mulcammatmap-be/blob/dev/src/main/java/com/example/multimatmap/config/SwaggerConfig.java"
    click AuthController "https://github.com/yebinnnnn/mulcammatmap-be/blob/dev/src/main/java/com/example/multimatmap/controller/AuthController.java"
    click RestaurantController "https://github.com/yebinnnnn/mulcammatmap-be/blob/dev/src/main/java/com/example/multimatmap/controller/RestaurantController.java"
    click CommentController "https://github.com/yebinnnnn/mulcammatmap-be/blob/dev/src/main/java/com/example/multimatmap/controller/CommentController.java"
    click ReviewController "https://github.com/yebinnnnn/mulcammatmap-be/blob/dev/src/main/java/com/example/multimatmap/controller/ReviewController.java"
    click SlackController "https://github.com/yebinnnnn/mulcammatmap-be/blob/dev/src/main/java/com/example/multimatmap/controller/SlackController.java"
    click SlackEventController "https://github.com/yebinnnnn/mulcammatmap-be/blob/dev/src/main/java/com/example/multimatmap/controller/SlackEventController.java"
    click MemberService "https://github.com/yebinnnnn/mulcammatmap-be/blob/dev/src/main/java/com/example/multimatmap/service/MemberService.java"
    click RestaurantService "https://github.com/yebinnnnn/mulcammatmap-be/blob/dev/src/main/java/com/example/multimatmap/service/RestaurantService.java"
    click CommentService "https://github.com/yebinnnnn/mulcammatmap-be/blob/dev/src/main/java/com/example/multimatmap/service/CommentService.java"
    click ReviewService "https://github.com/yebinnnnn/mulcammatmap-be/blob/dev/src/main/java/com/example/multimatmap/service/ReviewService.java"
    click SlackService "https://github.com/yebinnnnn/mulcammatmap-be/blob/dev/src/main/java/com/example/multimatmap/service/SlackService.java"
    click GeocodingService "https://github.com/yebinnnnn/mulcammatmap-be/blob/dev/src/main/java/com/example/multimatmap/service/GeocodingService.java"
    click MemberRepo "https://github.com/yebinnnnn/mulcammatmap-be/blob/dev/src/main/java/com/example/multimatmap/repository/MemberRepository.java"
    click RestaurantRepo "https://github.com/yebinnnnn/mulcammatmap-be/blob/dev/src/main/java/com/example/multimatmap/repository/RestaurantRepository.java"
    click CommentRepo "https://github.com/yebinnnnn/mulcammatmap-be/blob/dev/src/main/java/com/example/multimatmap/repository/CommentRepository.java"
    click ReviewRepo "https://github.com/yebinnnnn/mulcammatmap-be/blob/dev/src/main/java/com/example/multimatmap/repository/ReviewRepository.java"
    click CategoryRepo "https://github.com/yebinnnnn/mulcammatmap-be/blob/dev/src/main/java/com/example/multimatmap/repository/CategoryRepository.java"
    click CatRestRepo "https://github.com/yebinnnnn/mulcammatmap-be/blob/dev/src/main/java/com/example/multimatmap/repository/CategoryRestaurantRepository.java"
    click DataLoader "https://github.com/yebinnnnn/mulcammatmap-be/blob/dev/src/main/resources/application-dev.yml"
    click DataLoader "https://github.com/yebinnnnn/mulcammatmap-be/blob/dev/src/main/resources/application-prod.yml"

    %% Styles
    classDef controllers fill:#cce5ff,stroke:#004085,color:#004085;
    classDef services fill:#d4edda,stroke:#155724,color:#155724;
    classDef repositories fill:#fff3cd,stroke:#856404,color:#856404;
    classDef external fill:#e2e3e5,stroke:#6c757d,color:#6c757d;
    classDef config fill:#f5c6cb,stroke:#721c24,color:#721c24;
    classDef database fill:#ffeeba,stroke:#d39e00,color:#856404;
```
