# prgrms-web-devcourse/team_bbungcles_devnity_be architecture

> Architecture diagram of the GitHub repository prgrms-web-devcourse/team_bbungcles_devnity_be, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-20). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/prgrms-web-devcourse/team_bbungcles_devnity_be
- Repository: https://github.com/prgrms-web-devcourse/team_bbungcles_devnity_be

## Overview

##### Main Components

a) Client-Side Layer:
- Frontend Application (React/Next.js implied from README)
- CloudFront (Static Resource CDN)

b) API Gateway Layer:
- Nginx (Load Balancer & Reverse Proxy)
- Blue-Green Deployment Configuration

c) Application Layer:
- Spring Boot Application Containers (Multiple instances)
- Core Modules:
- Authentication/Authorization (JWT)
- User Management
- Community Features (Introductions, Gatherings, MapGakco)
- Admin Management
- Media Handling

d) Persistence Layer:
- MySQL Database (RDS)
- S3 Storage (Media files)

e) External Services:
- Slack Integration (for notifications)
- API Integration

##### Architectural Patterns to Highlight

- Blue for client-facing components
- Green for application services
- Yellow for data persistence
- Gray for external services

- Following patterns:
- MVC architecture (evident from the package structure)
- Repository pattern (shown in data access layer)
- Event-driven architecture (for notifications)
- Domain-driven design (clear from domain package structure)

##### Key Flows

a) Authentication Flow:
- JWT token generation and validation
- Security filter chain

b) Main Feature Flows:
- User registration with invitation system
- Community interaction paths
- Media upload process
- Location-based service flow

##### Infrastructure Components

- AWS Services:
- EC2 instances
- RDS database
- S3 storage
- CloudFront CDN
- CI/CD Pipeline:
- GitHub Actions
- Docker containers
- Blue-Green deployment setup

##### Specific Implementation Details

- Annotations for:
- Cursor-based pagination
- Scheduled tasks
- Caching mechanisms
- Security filters

##### External Services Layer

Left to Right:
- Core services
- Supporting services
- Monitoring/Logging

##### Additional Elements

- Numbered sequence flows for key operations
- Scaling points and redundancy
- Monitoring and logging points

- The microservice-like architecture with clear domain boundaries
- The robust deployment strategy with blue-green deployment
- The security implementation with JWT
- The scalability aspects with containerization
- The integration points with external services

Remember to maintain a balance between detail and clarity, focusing on the architectural decisions that make this system unique, such as the location-based services and community features.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Styles
    classDef frontend fill:#2196F3,stroke:#1565C0,color:white
    classDef infra fill:#78909C,stroke:#455A64,color:white
    classDef service fill:#4CAF50,stroke:#2E7D32,color:white
    classDef database fill:#FFA000,stroke:#F57C00,color:white
    classDef external fill:#9E9E9E,stroke:#616161,color:white
    classDef security fill:#E91E63,stroke:#C2185B,color:white

    %% Client Layer
    subgraph ClientLayer
        Browser["Web Browser"]:::frontend
        MobileApp["Mobile App"]:::frontend
    end

    %% CDN/Load Balancer Layer
    CloudFront["CloudFront CDN"]:::infra
    Nginx["Nginx Load Balancer"]:::infra
    
    %% Application Layer
    subgraph AppLayer
        direction TB
        Auth["Authentication Service"]:::security
        UserMgmt["User Management"]:::service
        
        subgraph CommunityFeatures
            direction TB
            Intro["Introductions"]:::service
            Gather["Gatherings"]:::service
            MapGakco["MapGakco"]:::service
        end
        
        AdminMgmt["Admin Management"]:::service
        MediaHandler["Media Handler"]:::service
        ErrorHandler["Error Handler"]:::service
    end

    %% Persistence Layer
    subgraph DataLayer
        MySQL[(MySQL RDS)]:::database
        S3["S3 Storage"]:::database
    end

    %% External Services
    subgraph ExternalServices
        Slack["Slack Integration"]:::external
        MapAPI["Map API"]:::external
    end

    %% Infrastructure
    subgraph Infrastructure
        GithubActions["GitHub Actions"]:::infra
        Docker["Docker Containers"]:::infra
        BlueGreen["Blue-Green Deployment"]:::infra
    end

    %% Connections
    Browser & MobileApp --> CloudFront
    CloudFront --> Nginx
    Nginx --> Auth
    Auth --> UserMgmt & AdminMgmt
    UserMgmt --> CommunityFeatures
    CommunityFeatures --> MapAPI
    MediaHandler --> S3
    AppLayer --> MySQL
    AdminMgmt --> Slack

    %% Click Events
    click Auth "https://github.com/prgrms-web-devcourse/Team_BbungCles_Devnity_BE/tree/develop/src/main/java/com/devnity/devnity/web/common/config/security/jwt/"
    click UserMgmt "https://github.com/prgrms-web-devcourse/Team_BbungCles_Devnity_BE/tree/develop/src/main/java/com/devnity/devnity/domain/user/"
    click Intro "https://github.com/prgrms-web-devcourse/Team_BbungCles_Devnity_BE/tree/develop/src/main/java/com/devnity/devnity/domain/introduction/"
    click Gather "https://github.com/prgrms-web-devcourse/Team_BbungCles_Devnity_BE/tree/develop/src/main/java/com/devnity/devnity/domain/gather/"
    click MapGakco "https://github.com/prgrms-web-devcourse/Team_BbungCles_Devnity_BE/tree/develop/src/main/java/com/devnity/devnity/domain/mapgakco/"
    click AdminMgmt "https://github.com/prgrms-web-devcourse/Team_BbungCles_Devnity_BE/tree/develop/src/main/java/com/devnity/devnity/domain/admin/"
    click MediaHandler "https://github.com/prgrms-web-devcourse/Team_BbungCles_Devnity_BE/tree/develop/src/main/java/com/devnity/devnity/common/s3/"
    click ErrorHandler "https://github.com/prgrms-web-devcourse/Team_BbungCles_Devnity_BE/tree/develop/src/main/java/com/devnity/devnity/common/error/"
    click BlueGreen "https://github.com/prgrms-web-devcourse/Team_BbungCles_Devnity_BE/tree/develop/deploy/"
    click GithubActions "https://github.com/prgrms-web-devcourse/Team_BbungCles_Devnity_BE/tree/develop/.github/workflows/"
```
