# boostcampwm-2024/web20-camon architecture

> Architecture diagram of the GitHub repository boostcampwm-2024/web20-camon, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-22). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/boostcampwm-2024/web20-camon
- Repository: https://github.com/boostcampwm-2024/web20-camon

## Overview

##### Project type and purpose
- This is a full‑stack, microservice‑oriented web application (“Cam’On”) for real‑time video broadcasting, chat, recording, attendance tracking, and archival management.
- The README confirms core features: real‑time streaming (WebRTC/Mediasoup), chat (WebSockets), record/encoding (FFmpeg), attendance (NestJS + MySQL), and a React/Tailwind front end.

##### File structure
- Top‑level “apps” folder houses five services:
- api: REST API (NestJS) for auth, attendance, bookmarks, broadcast metadata, record metadata, member profiles.
- chat: WebSocket (NestJS Gateway) handling real‑time chat, using in‑memory + Redis.
- media: Mediasoup SFU service (NestJS) for routing video/audio, transport & consumer/producer management.
- record: Node.js service handling media ingest, FFmpeg-based conversion & queuing, object‑storage integration.
- client: React + Vite front end for UI, authentication, video publish/view, chat, attendance, archive.
- Root docker-compose.yml & per‑service Dockerfiles + GitHub Actions workflows indicate containerized deployment.
- Shared infra concerns: MySQL, Redis, Nginx (ingress), object storage (S3‑compatible), CI/CD.

##### README for additional insights
- Tech stack: TypeScript, pnpm, React/Tailwind, NestJS, MySQL, FFmpeg, Docker, GitHub Actions, NCloud.

##### Detailed breakdown of essential elements
- Edge router: “Nginx / LB” directing HTTP→Client/API, WS→Chat/Media.
- Infrastructure layer: MySQL, Redis, S3 Storage
- Bottom: “GitHub Actions” → builds Docker images → pushes to registry → triggers container deployment.

Summary

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Edge
    Browser["User Browser\n(React UI)"]:::client
    Browser -->|"HTTPS"| NGINX["Nginx / Load Balancer"]:::edge

    %% Services cluster
    subgraph "Microservices (apps/)"
        direction TB
        Client["Web Client"]:::service
        API["API Service\n(NestJS REST)"]:::service
        Chat["Chat Service\n(WebSocket Gateway)"]:::service
        Media["SFU Service\n(Mediasoup)"]:::service
        Record["Recording Service\n(FFmpeg Queue)"]:::service
    end

    %% Infra
    subgraph "Infrastructure"
        direction TB
        MySQL[(MySQL)]:::db
        Redis[(Redis)]:::cache
        Storage[("Object Storage\n(S3)")]:::storage
        Queue(("Recording Queue")):::queue
    end

    %% External
    subgraph "External OAuth"
        direction TB
        Google["Google OAuth"]:::external
        GitHub["GitHub OAuth"]:::external
    end

    %% CI/CD and Orchestration
    CI["GitHub Actions"]:::ci
    Compose["docker-compose.yml"]:::ci

    %% Connections
    NGINX -->|Serves Assets| Client
    NGINX -->|Route REST| API
    NGINX -->|Route WS| Chat
    NGINX -->|Route WS| Media

    Client -->|"HTTPS REST"| API
    Client -->|"WSS Chat"| Chat
    Client -->|"WebRTC Signaling"| Media
    Client -->|"HTTP to trigger record"| Record

    API -->|"CRUD Metadata"| MySQL
    Chat -->|"Pub/Sub"| Redis
    Media -->|"Pub/Sub"| Redis
    Media -->|"Metadata access"| MySQL
    Record -->|Enqueue Raw WebM| Queue
    Record -->|Upload MP4/HLS| Storage

    Browser -->|OAuth Flow| Google
    Browser -->|OAuth Flow| GitHub
    API -->|Token Validation| Google
    API -->|Token Validation| GitHub

    CI -->|Build & Push| Compose

    %% Click events
    click Client "https://github.com/boostcampwm-2024/web20-camon/tree/develop/apps/client"
    click API "https://github.com/boostcampwm-2024/web20-camon/tree/develop/apps/api"
    click Chat "https://github.com/boostcampwm-2024/web20-camon/tree/develop/apps/chat"
    click Media "https://github.com/boostcampwm-2024/web20-camon/tree/develop/apps/media"
    click Record "https://github.com/boostcampwm-2024/web20-camon/tree/develop/apps/record"
    click OAuthStrategies "https://github.com/boostcampwm-2024/web20-camon/tree/develop/apps/api/src/auth/strategy"
    click ChatRedisConfig "https://github.com/boostcampwm-2024/web20-camon/blob/develop/apps/chat/src/config/redis.config.ts"
    click MediaRedisModule "https://github.com/boostcampwm-2024/web20-camon/blob/develop/apps/media/src/redis.module.ts"
    click StorageIntegration "https://github.com/boostcampwm-2024/web20-camon/blob/develop/apps/record/src/object.ts"
    click RecordQueueLogic "https://github.com/boostcampwm-2024/web20-camon/blob/develop/apps/record/src/queue.ts"
    click Compose "https://github.com/boostcampwm-2024/web20-camon/blob/develop/docker-compose.yml"
    click CI "https://github.com/boostcampwm-2024/web20-camon/tree/develop/ .github/workflows"

    %% Styles
    classDef client fill:#AEDFF7,stroke:#036,stroke-width:1px;
    classDef edge fill:#E2E2E2,stroke:#999,stroke-width:1px;
    classDef service fill:#D6EAF8,stroke:#2E86C1,stroke-width:1px;
    classDef db fill:#FADBD8,stroke:#C0392B,stroke-width:1px;
    classDef cache fill:#FCF3CF,stroke:#F1C40F,stroke-width:1px;
    classDef storage fill:#D5F5E3,stroke:#27AE60,stroke-width:1px;
    classDef queue fill:#F5EEF8,stroke:#8E44AD,stroke-width:1px,stroke-dasharray: 5 5;
    classDef external fill:#FDEBD0,stroke:#D35400,stroke-width:1px;
    classDef ci fill:#E8F8F5,stroke:#1ABC9C,stroke-width:1px;
```
