# mc-team-two/altspace architecture

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

- Interactive diagram: https://gitdiagram.com/mc-team-two/altspace
- Repository: https://github.com/mc-team-two/altspace

## Overview

##### Project type and purpose
- This is a full-stack web application for a space-rental platform (“Alt Space”) with two Gradle modules:
- admin – the host/administrator portal
- client – the guest/public portal
- Both modules use Spring Boot (MVC + MyBatis), JSP/HTML/CSS/JS for views, MySQL for persistence, and integrate with external services (AI, email, OAuth2, WebSocket).

##### File structure
- Top-level modules:
- admin/ – host portal (DTO, repository, service, controller, config, util, static assets, JSP views)
- client/ – guest portal (similar layered structure, plus RESTful controllers, AI/Chatbot integration)
- Shared patterns:
- Layered MVC: controllers → services → repositories (MyBatis mappers) → MySQL
- Configuration packages for security, mail, WebSocket, locale, file upload
- Static resources under src/main/resources/static and JSP views under src/main/webapp/views
- Build & deploy: Gradle wrapper, application-*.yml, Naver Cloud Platform

##### README
- Confirms tech stack: Java, Spring Boot, MyBatis, JSP, Bootstrap, MySQL, Gem​ini AI, NCP
- Shows high-level UI flow, service flow, and ERD
- External integrations: OAuth2 (Google/Kakao/Naver), Papago, Gemini AI

a. Main components
- Frontends:
– Client UI (JSP/HTML/JS/CSS) served by ClientApplication
– Admin UI (static assets + JSP) served by AdminApplication
- Backend services (two Spring Boot applications)
- Database: MySQL (single or separate schemas for admin/client)
- External services:
– OAuth2 providers (Google, Kakao, Naver)
– Email SMTP service
– Gemini AI API
– Papago translation API
- WebSocket broker for real-time messaging (StompWebSocketConfig)

b. Relationships and interactions
1. User → UI (browser)
2. UI → Spring Boot controller (MVC or REST API)
3. Controller → Service layer → Repository (MyBatis mapper) → MySQL
4. Service layer may call external APIs (AI, translation, email, OAuth2)
5. For notifications/chat, WebSocket channel broadcasts via Spring’s message broker

c. Architectural patterns & principles
- Layered architecture (presentation, business, data)
- Separation of concerns: two distinct modules for host vs guest
- MyBatis for data mapping, DTOs to isolate domain objects
- Config-driven security (OAuth2, JWT if any), internationalization, file upload
- Externalization of environment: application-dev/server.yml

d. Key technologies/frameworks
- Spring Boot (MVC, Security, WebSocket)
- MyBatis (mapper XML under resources/mapper)
- JSP + Bootstrap + custom JS/CSS
- MySQL on NCP
- Gemini AI, Papago
- OAuth2 (Google/Kakao/Naver)

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Admin Module
    subgraph "Admin Module"
        direction TB
        AdminApp["AdminApplication (Spring Boot)"]:::backend
        click AdminApp "https://github.com/mc-team-two/altspace/blob/master/admin/src/main/java/com/mc/AdminApplication.java"

        subgraph "Presentation Layer"
            direction TB
            AdminStatic["Static Assets"]:::frontend
            click AdminStatic "https://github.com/mc-team-two/altspace/tree/master/admin/src/main/resources/static"
            AdminJSP["JSP Views"]:::frontend
            click AdminJSP "https://github.com/mc-team-two/altspace/tree/master/admin/src/main/webapp/views"
        end

        subgraph "Controller Layer"
            direction TB
            AdminMVC["MVC Controllers"]:::backend
            click AdminMVC "https://github.com/mc-team-two/altspace/tree/master/admin/src/main/java/com/mc/controller"
            AdminAPI["REST Controllers"]:::backend
            click AdminAPI "https://github.com/mc-team-two/altspace/tree/master/admin/src/main/java/com/mc/controller/api"
            AdminOAuth2["OAuth2 Controllers"]:::backend
            click AdminOAuth2 "https://github.com/mc-team-two/altspace/tree/master/admin/src/main/java/com/mc/controller/api/oauth2"
            AdminWS["WebSocket Controller"]:::backend
            click AdminWS "https://github.com/mc-team-two/altspace/blob/master/admin/src/main/java/com/mc/controller/msg/MsgController.java"
        end

        subgraph "Service Layer"
            direction TB
            AdminService["Admin Services"]:::backend
            click AdminService "https://github.com/mc-team-two/altspace/tree/master/admin/src/main/java/com/mc/app/service"
            AdminUtil["Utility Classes"]:::backend
            click AdminUtil "https://github.com/mc-team-two/altspace/tree/master/admin/src/main/java/com/mc/util"
        end

        subgraph "Data Access Layer"
            direction TB
            AdminRepo["MyBatis Repositories"]:::backend
            click AdminRepo "https://github.com/mc-team-two/altspace/tree/master/admin/src/main/java/com/mc/app/repository"
            AdminDTO["DTOs"]:::backend
            click AdminDTO "https://github.com/mc-team-two/altspace/tree/master/admin/src/main/java/com/mc/app/dto"
            AdminMapperXML["MyBatis XML Mappers"]:::backend
            click AdminMapperXML "https://github.com/mc-team-two/altspace/tree/master/admin/src/main/resources/mapper"
        end

    end

    %% Client Module
    subgraph "Client Module"
        direction TB
        ClientApp["ClientApplication (Spring Boot)"]:::backend
        click ClientApp "https://github.com/mc-team-two/altspace/blob/master/client/src/main/java/com/mc/ClientApplication.java"

        subgraph "Presentation Layer"
            direction TB
            ClientStatic["Static Assets"]:::frontend
            click ClientStatic "https://github.com/mc-team-two/altspace/tree/master/client/src/main/resources/static"
            ClientJSP["JSP Views"]:::frontend
            click ClientJSP "https://github.com/mc-team-two/altspace/tree/master/client/src/main/webapp/views"
        end

        subgraph "Controller Layer"
            direction TB
            ClientMVC["MVC Controllers"]:::backend
            click ClientMVC "https://github.com/mc-team-two/altspace/tree/master/client/src/main/java/com/mc/controller"
            ClientREST["RESTful Controllers"]:::backend
            click ClientREST "https://github.com/mc-team-two/altspace/tree/master/client/src/main/java/com/mc/restfulController"
            ClientOAuth2["OAuth2 Controllers"]:::backend
            click ClientOAuth2 "https://github.com/mc-team-two/altspace/tree/master/client/src/main/java/com/mc/controller/oauth2"
        end

        subgraph "Service Layer"
            direction TB
            ClientService["Client Services"]:::backend
            click ClientService "https://github.com/mc-team-two/altspace/tree/master/client/src/main/java/com/mc/app/service"
            ClientUtil["Utility Classes"]:::backend
            click ClientUtil "https://github.com/mc-team-two/altspace/tree/master/client/src/main/java/com/mc/util"
        end

        subgraph "Data Access Layer"
            direction TB
            ClientRepo["MyBatis Repositories"]:::backend
            click ClientRepo "https://github.com/mc-team-two/altspace/tree/master/client/src/main/java/com/mc/app/repository"
            ClientDTO["DTOs"]:::backend
            click ClientDTO "https://github.com/mc-team-two/altspace/tree/master/client/src/main/java/com/mc/app/dto"
            ClientMapperXML["MyBatis XML Mappers"]:::backend
            click ClientMapperXML "https://github.com/mc-team-two/altspace/tree/master/client/src/main/resources/mapper"
        end

    end

    %% Shared Resources
    subgraph "Shared Resources"
        direction TB
        DB["MySQL Database"]:::database
        OAuth["OAuth2 Providers"]:::external
        AI["Gemini AI API"]:::external
        Papago["Papago Translation API"]:::external
        Email["SMTP Email Service"]:::external
        WSBroker["WebSocket Broker"]:::external
        EnvConfigs["Environment Configs (YAML)"]:::infrastructure
        click EnvConfigs "https://github.com/mc-team-two/altspace/blob/master/admin/src/main/resources/application-*.yml"
        click EnvConfigs "https://github.com/mc-team-two/altspace/blob/master/client/src/main/resources/application-*.yml"
        Gradle["Gradle Build Scripts"]:::infrastructure
        click Gradle "https://github.com/mc-team-two/altspace/blob/master/admin/build.gradle"
        click Gradle "https://github.com/mc-team-two/altspace/blob/master/client/build.gradle"
    end

    %% Connections Admin
    AdminStatic -->|serves UI| AdminApp
    AdminJSP -->|serves UI| AdminApp
    AdminApp -->|routes to| AdminMVC
    AdminApp -->|routes to| AdminAPI
    AdminApp -->|routes WS| AdminWS
    AdminMVC -->|calls| AdminService
    AdminAPI -->|calls| AdminService
    AdminOAuth2 -->|auth via| OAuth
    AdminWS -->|push/sub| WSBroker
    AdminService -->|uses| AdminRepo
    AdminService -->|calls AI| AI
    AdminService -->|translates| Papago
    AdminService -->|emails| Email
    AdminService -->|logs/config| EnvConfigs
    AdminRepo -->|queries| DB

    %% Connections Client
    ClientStatic -->|serves UI| ClientApp
    ClientJSP -->|serves UI| ClientApp
    ClientApp -->|routes to| ClientMVC
    ClientApp -->|routes to| ClientREST
    ClientApp -->|routes WS| WSBroker
    ClientMVC -->|calls| ClientService
    ClientREST -->|calls| ClientService
    ClientOAuth2 -->|auth via| OAuth
    ClientApp -->|chat via| AI
    ClientService -->|uses| ClientRepo
    ClientService -->|translates| Papago
    ClientService -->|emails| Email
    ClientService -->|config| EnvConfigs
    ClientRepo -->|queries| DB

    %% Styles
    classDef frontend fill:#B3D4FC,stroke:#0366D6,color:#0366D6;
    classDef backend fill:#C8FDB3,stroke:#2E8B57,color:#2E8B57;
    classDef database fill:#FFD8B3,stroke:#FF8C00,color:#FF8C00;
    classDef external fill:#E3B3FC,stroke:#800080,color:#800080;
    classDef infrastructure fill:#D3D3D3,stroke:#696969,color:#696969;
```
