# boostcampwm-2021/web15-tadaktadak architecture

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

- Interactive diagram: https://gitdiagram.com/boostcampwm-2021/web15-tadaktadak
- Repository: https://github.com/boostcampwm-2021/web15-tadaktadak

## Overview

##### Project’s Nature and Core Purpose
- TadakTadak is a full-stack, real‑time communication web service allowing users to interact via video, audio, chat, and a “campfire” themed shared environment.
- The system supports rich features such as live room interactions, profile management, media streaming via Agora, and real-time chat via Socket.IO.

##### Break Down the System’s Major Components
a. Frontend Client:
- Located in the “client” directory, it is built using React and TypeScript.
- Manages presentation layers including pages (Campfire, Main, Profile, etc.), reusable components (SearchBar, Modal, Sidebar, etc.), and asset management.
- Implements API calls through a unified fetcher and utilizes contexts and hooks to manage state (e.g., theme, toast, user).

b. REST API Server:
- Found in “server/api”, built using NestJS and TypeScript, with a clear domain-driven structure (modules for auth, room, user, field, history, etc.).
- Handles API requests (including authentication, CRUD operations on users/rooms, uploads, etc.), standardizing API responses and errors through interceptors and filters.
- Interacts with persistent storage (likely MySQL) and adheres to a coherent DTO and builder strategy.

c. Socket Server:
- Located in “server/socket” and also built with NestJS.
- Responsible for real‑time features such as in-room chat, managing live user status, and communicating via Socket.IO.
- Uses Redis (via its Pub/Sub mechanism) to enable clustering and efficient real‑time message distribution between multiple socket server instances.

d. Infrastructure and External Services:
- MySQL and Redis should be represented as supporting infrastructure for persistence and high-speed data operations respectively.
- External media handling via Agora for video, audio, and screen sharing services.
- Deployment technologies include Docker (shown by Dockerfiles in both API and Socket directories) and Nginx reverse proxy for load balancing across containers.
- CI/CD pipelines are configured via GitHub workflows, ensuring automated testing and deployment for both API and Socket servers as well as the Frontend.

##### Interactions and Data Flow
- RESTful API interactions for user data, authentication, and CRUD operations.
- WebSocket connections (using Socket.IO) for real‑time data like chat, participant updates, and room events.
- API Server connecting to:
- MySQL for persistent data storage.
- Possibly external storage modules or authentication providers.
- Socket Server’s use of Redis for Pub/Sub clustering to distribute messages across server instances.
- A connection from both backend components to an “External Service” block representing Agora (for media streaming) and other 3rd‑party integrations.

##### Architectural Patterns and Design Principles
- The project uses a modular architecture (especially in the API server) by segregating domains (auth, room, user, etc.) in their own modules.
- Both backend servers leverage NestJS—which enforces patterns like controllers, services, and modules for clear separation of concerns.
- The client is component-driven (React) and uses state management contexts for unified behavior.
- Separation between synchronous (REST) and asynchronous (socket real‑time) interactions.
- Infrastructure components are decoupled (using Docker and Nginx) to support scaling and clustered deployments.

##### Final Checklist for the Principal Software Engineer
- Every major module from both “client” and “server” directories is represented.
- Distinguish storage (MySQL and Redis) and external integrations such as Agora.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Frontend Layer"
        A["Frontend Client (React & TypeScript)"]
    end

    subgraph "Backend Layer"
        B["API Server (NestJS REST)"]
        C["Socket Server (NestJS & Socket.IO)"]
    end

    subgraph "Infrastructure & Deployment"
        D["MySQL Database"]
        E["Redis (Pub/Sub)"]
        F["External Service (Agora)"]
        H["Docker & Nginx"]
        G["CI/CD Pipeline (.github/workflows)"]
    end

    A -->|"HTTP/REST"| B
    A -->|"WebSocket"| C
    B -->|"CRUD"| D
    B -->|"MediaStreaming"| F
    C -->|"PubSub"| E
    C -->|"MediaStreaming"| F
    B -->|"Containerized"| H
    C -->|"Containerized"| H
    G -->|"Deploys"| A
    G -->|"Deploys"| B
    G -->|"Deploys"| C

    click A "https://github.com/boostcampwm-2021/web15-tadaktadak/tree/main/client"
    click B "https://github.com/boostcampwm-2021/web15-tadaktadak/tree/main/server/api"
    click C "https://github.com/boostcampwm-2021/web15-tadaktadak/tree/main/server/socket"
    click G "https://github.com/boostcampwm-2021/web15-tadaktadak/tree/main/.github/workflows"

    class A frontend
    class B api
    class C socket
    class D infra
    class E infra
    class H infra
    class F external
    class G pipeline

    classDef frontend fill:#add8e6,stroke:#333,stroke-width:2px;
    classDef api fill:#90ee90,stroke:#333,stroke-width:2px;
    classDef socket fill:#ffa500,stroke:#333,stroke-width:2px;
    classDef infra fill:#D3D3D3,stroke:#333,stroke-width:2px;
    classDef pipeline fill:#dda0dd,stroke:#333,stroke-width:2px;
    classDef external fill:#ffb6c1,stroke:#333,stroke-width:2px;
```
