# woowacourse-teams/2020-seller-lee-company architecture

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

- Interactive diagram: https://gitdiagram.com/woowacourse-teams/2020-seller-lee-company
- Repository: https://github.com/woowacourse-teams/2020-seller-lee-company

## Overview

##### Main System Components

a) Frontend Layer:
- React Native Mobile Application (found in /front directory)
- Key modules to highlight:
- Authentication components (/src/auth)
- Chat features (/src/components/chat)
- Article/Product management (/src/components/Article)
- Organization management (/src/components/organization)

b) Backend Layer:
Split into two main services:
- API Service (/back/api):
- Core business logic
- Authentication/Authorization
- Article management
- Organization management
- Member management

- Chat Service (/back/chat):
- Real-time messaging
- WebSocket connections
- Message persistence

c) Database Layer:
- MariaDB (indicated by Dockerfile-mariadb)
- MongoDB (indicated by MongoConfig.java in chat service)

d) Infrastructure:
- Docker containers (multiple Dockerfile presence)
- Jenkins CI/CD pipeline (Jenkinsfile)

##### Relationships and Data Flow

- Client-Server communication via REST APIs
- WebSocket connections for real-time chat
- Database interactions
- Authentication flow with OAuth2 (indicated by OAuth2 related files)

##### Key Architectural Patterns to Highlight

a) Microservices Architecture:
- Separate API and Chat services
- Independent deployments
- Different database technologies for different services

b) Domain-Driven Design:
- Clear domain separation (article, chat, member, organization)
- Rich domain models with clear boundaries

c) Layered Architecture in Each Service:
- Presentation layer (controllers)
- Application layer (services)
- Domain layer (entities)
- Infrastructure layer (repositories)

##### Technical Components

a) Security Layer:
- OAuth2 authentication
- JWT token management
- Security filters

b) External Services:
- Kakao Login integration
- Push notification service

c) Storage:
- File storage for images
- Database systems

##### Specific Implementation Details

Specialized components:
- Event-driven architecture (indicated by event listeners)
- Caching mechanisms
- Message queues for asynchronous operations

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Frontend
        MobileApp["Mobile Application"]:::frontend
        Auth["Authentication"]:::frontend
        Chat["Chat Features"]:::frontend
        Article["Article Management"]:::frontend
        Org["Organization Management"]:::frontend
        
        MobileApp --> Auth
        MobileApp --> Chat
        MobileApp --> Article
        MobileApp --> Org
    end

    subgraph "Backend Services"
        subgraph "API Service"
            APICore["API Core"]:::backend
            ArticleAPI["Article Management"]:::backend
            MemberAPI["Member Management"]:::backend
            OrgAPI["Organization Management"]:::backend
            TradeAPI["Trade Management"]:::backend
            
            APICore --> ArticleAPI
            APICore --> MemberAPI
            APICore --> OrgAPI
            APICore --> TradeAPI
        end

        subgraph "Chat Service"
            ChatCore["Chat Core"]:::backend
            MessageMgmt["Message Management"]:::backend
            WSConfig["WebSocket Config"]:::backend
            
            ChatCore --> MessageMgmt
            ChatCore --> WSConfig
        end

        subgraph "Security Layer"
            SecCore["Security Core"]:::security
            OAuth["OAuth2"]:::security
            JWT["JWT Filter"]:::security
            
            SecCore --> OAuth
            SecCore --> JWT
        end

        subgraph "Common Components"
            Notifications["Notifications"]:::common
        end
    end

    subgraph "Data Layer"
        MariaDB[(MariaDB)]:::database
        MongoDB[(MongoDB)]:::database
    end

    subgraph "External Services"
        KakaoLogin["Kakao Login"]:::external
        PushService["Push Notifications"]:::external
    end

    subgraph "CI/CD"
        Jenkins["Jenkins Pipeline"]:::cicd
    end

    %% Frontend to Backend Connections
    Auth --> SecCore
    Chat --> ChatCore
    Article --> ArticleAPI
    Org --> OrgAPI

    %% Backend Internal Connections
    APICore --> SecCore
    ChatCore --> SecCore
    APICore --> MariaDB
    ChatCore --> MongoDB
    SecCore --> KakaoLogin
    Notifications --> PushService

    %% CI/CD Connections
    Jenkins --> MobileApp
    Jenkins --> APICore
    Jenkins --> ChatCore

    %% Click Events
    click MobileApp "https://github.com/woowacourse-teams/2020-seller-lee-company/tree/develop/front/src/components"
    click Auth "https://github.com/woowacourse-teams/2020-seller-lee-company/tree/develop/front/src/components/auth"
    click Chat "https://github.com/woowacourse-teams/2020-seller-lee-company/tree/develop/front/src/components/chat"
    click Article "https://github.com/woowacourse-teams/2020-seller-lee-company/tree/develop/front/src/components/Article"
    click Org "https://github.com/woowacourse-teams/2020-seller-lee-company/tree/develop/front/src/components/organization"
    click APICore "https://github.com/woowacourse-teams/2020-seller-lee-company/tree/develop/back/api/src/main/java/com/jikgorae/api"
    click ArticleAPI "https://github.com/woowacourse-teams/2020-seller-lee-company/tree/develop/back/api/src/main/java/com/jikgorae/api/article"
    click MemberAPI "https://github.com/woowacourse-teams/2020-seller-lee-company/tree/develop/back/api/src/main/java/com/jikgorae/api/member"
    click OrgAPI "https://github.com/woowacourse-teams/2020-seller-lee-company/tree/develop/back/api/src/main/java/com/jikgorae/api/organization"
    click TradeAPI "https://github.com/woowacourse-teams/2020-seller-lee-company/tree/develop/back/api/src/main/java/com/jikgorae/api/trade"
    click ChatCore "https://github.com/woowacourse-teams/2020-seller-lee-company/tree/develop/back/chat"
    click MessageMgmt "https://github.com/woowacourse-teams/2020-seller-lee-company/tree/develop/back/chat/src/main/java/com/jikgorae/chat/message"
    click WSConfig "https://github.com/woowacourse-teams/2020-seller-lee-company/blob/develop/back/chat/src/main/java/com/jikgorae/chat/config/WebSockConfig.java"
    click SecCore "https://github.com/woowacourse-teams/2020-seller-lee-company/tree/develop/back/api/src/main/java/com/jikgorae/api/security"
    click OAuth "https://github.com/woowacourse-teams/2020-seller-lee-company/tree/develop/back/api/src/main/java/com/jikgorae/api/security/oauth2"
    click JWT "https://github.com/woowacourse-teams/2020-seller-lee-company/blob/develop/back/api/src/main/java/com/jikgorae/api/security/filter/JwtAuthenticationFilter.java"
    click MariaDB "https://github.com/woowacourse-teams/2020-seller-lee-company/tree/develop/Dockerfile-mariadb"
    click MongoDB "https://github.com/woowacourse-teams/2020-seller-lee-company/blob/develop/back/chat/src/main/java/com/jikgorae/chat/config/MongoConfig.java"
    click Jenkins "https://github.com/woowacourse-teams/2020-seller-lee-company/tree/develop/Jenkinsfile"
    click Notifications "https://github.com/woowacourse-teams/2020-seller-lee-company/tree/develop/back/common/src/main/java/com/jikgorae/common/notification"

    %% Styling
    classDef frontend fill:#2196F3,stroke:#1565C0,color:white
    classDef backend fill:#4CAF50,stroke:#2E7D32,color:white
    classDef security fill:#f44336,stroke:#c62828,color:white
    classDef database fill:#FFC107,stroke:#FFA000,color:black
    classDef external fill:#9C27B0,stroke:#6A1B9A,color:white
    classDef common fill:#00BCD4,stroke:#00838F,color:white
    classDef cicd fill:#795548,stroke:#4E342E,color:white
```
