# p0nch0d3v/scrum-poker architecture

> Architecture diagram of the GitHub repository p0nch0d3v/scrum-poker, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/p0nch0d3v/scrum-poker
- Repository: https://github.com/p0nch0d3v/scrum-poker

## Overview

##### Main Components
- Backend API (apps/api): This is built with Nestjs. Within it, you have clearly defined modules (auth, config, room, serie, user). Note the migration scripts and WebSocket-specific components (e.g., socket.gateway.ts, socket.service.ts) which indicate real-time communication in the room functionalities.
- Frontend Client (apps/client): A Vite-powered React application with numerous components (JoinRoom, CreateRoom, Login, etc.), context providers, hooks, and services that perform API communication.
- Shared Code and Models (apps/common & apps/models): These directories house common utilities and strongly typed DTOs/models that can be consumed by both frontend and backend.
- Supporting Infrastructure: Docker-related files (Dockerfile, docker-compose.yml, docker_entry_point.sh) and CI/CD workflows (under .github/workflows) indicate containerized deployment and automated builds/tests.

##### Relationships and Interactions
- Real-time Data Flow: Highlight the WebSocket mechanisms present in the “room” module (socket.gateway.ts & socket.service.ts) which manage bidirectional communication for live updates.
- Shared Modules/Models: Show that both the backend (apps/api) and possibly the frontend (indirectly via types/interfaces) depend on the DTOs and entities located in apps/models. A shared common module (apps/common) may also be used across different parts of the system.

##### Architectural Patterns and Design Principles
- Modular Architecture: In the backend, separate modules (for auth, config, room, etc.) enforce the modular design of Nestjs.
- Separation of Concerns: The client’s separation into components, hooks, contexts, and services ensures clear delineation between UI, state management, and business logic.
- Containerization and CI/CD: With Dockerfiles and GitHub workflows configured for both development and production environments, highlight how containerization encapsulates the app and automated pipelines help in continuous deployment.
- Shared Contracts: Including a common models layer that supplies DTO definitions reinforces consistency between API contracts and UI expectations.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Supporting Infrastructure
    subgraph "Supporting Infrastructure"
        I1("Docker & CI/CD"):::infra
    end

    %% Backend API and its Modules
    subgraph "Backend API"
        BA("Backend API (Nestjs)"):::backend
        Auth("Auth Module"):::backend
        Config("Config Module"):::backend
        Room("Room Module (WebSocket)"):::backend
        Serie("Serie Module"):::backend
        User("User Module"):::backend
        Migr("Database Migrations"):::backend
    end

    %% Frontend Client
    subgraph "Frontend Client"
        FE("Frontend Client"):::frontend
        FE1("React Components"):::frontend
        FE2("API Service"):::frontend
    end

    %% Shared Modules
    subgraph "Shared Modules"
        Common("Common Utilities"):::shared
        Models("DTOs/Models"):::shared
    end

    %% Database
    DB("Database"):::database

    %% Connections
    I1 -->|"deploys"| BA
    I1 -->|"deploys"| FE

    BA -->|"contains"| Auth
    BA -->|"contains"| Config
    BA -->|"contains"| Room
    BA -->|"contains"| Serie
    BA -->|"contains"| User
    BA -->|"uses"| Migr
    Migr -->|"updates"| DB

    FE2 -->|"APIcalls"| BA
    Room -->|"WebSocket"| FE2

    BA -->|"uses"| Common
    BA -->|"uses"| Models
    FE2 -->|"uses"| Models

    FE --> FE1
    FE --> FE2

    %% Click Events
    click BA "https://github.com/p0nch0d3v/scrum-poker/tree/master/apps/api"
    click Auth "https://github.com/p0nch0d3v/scrum-poker/tree/master/apps/api/src/auth"
    click Config "https://github.com/p0nch0d3v/scrum-poker/tree/master/apps/api/src/config"
    click Room "https://github.com/p0nch0d3v/scrum-poker/tree/master/apps/api/src/room"
    click Serie "https://github.com/p0nch0d3v/scrum-poker/tree/master/apps/api/src/serie"
    click User "https://github.com/p0nch0d3v/scrum-poker/tree/master/apps/api/src/user"
    click Migr "https://github.com/p0nch0d3v/scrum-poker/tree/master/apps/api/src/migrations"
    click FE "https://github.com/p0nch0d3v/scrum-poker/tree/master/apps/client"
    click FE1 "https://github.com/p0nch0d3v/scrum-poker/tree/master/apps/client/src/components"
    click FE2 "https://github.com/p0nch0d3v/scrum-poker/blob/master/apps/client/src/services/api.service.tsx"
    click Common "https://github.com/p0nch0d3v/scrum-poker/tree/master/apps/common"
    click Models "https://github.com/p0nch0d3v/scrum-poker/tree/master/apps/models"
    click I1 "https://github.com/p0nch0d3v/scrum-poker/tree/master/.github/workflows"

    %% Styles
    classDef backend fill:#ADD8E6,stroke:#000,stroke-width:2px;
    classDef frontend fill:#FFB6C1,stroke:#000,stroke-width:2px;
    classDef shared fill:#90EE90,stroke:#000,stroke-width:2px;
    classDef infra fill:#FFD700,stroke:#000,stroke-width:2px;
    classDef database fill:#F0E68C,stroke:#000,stroke-width:2px;
```
