# akiver/cs-demo-manager architecture

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

- Interactive diagram: https://gitdiagram.com/akiver/cs-demo-manager
- Repository: https://github.com/akiver/cs-demo-manager

## Overview

##### Main Components Identification

a) Frontend Layer (UI):
- Located in `/src/ui`
- Contains React components for various features
- Includes settings, matches, players, teams, and video management interfaces

b) Backend Layer (Node):
- Located in `/src/node`
- Handles demo analysis, file system operations, and database interactions
- Includes integrations with Steam, FACEIT, and 5ePlay APIs

c) Server Layer:
- Located in `/src/server`
- Manages WebSocket communication
- Handles various process events and messages

d) Native Plugins:
- CS2 Server Plugin (`/cs2-server-plugin`)
- CSGO Server Plugin (`/csgo-server-plugin`)
- Handles game-specific functionality

**[UI Layer]**
- Components (React)
- State Management (Redux)
- WebSocket Client

**[IPC/Communication Layer]**
- WebSocket Server
- IPC Channels

**[Application Core]**
- Demo Analysis
- Video Generation
- Game Integration

**[Data Layer]**
- Database Operations
- File System
- External APIs

**[Native Integration]**
- CS2 Plugin
- CSGO Plugin

##### Key Relationships to Highlight

- Bidirectional communication between UI and Server layers via WebSocket
- Data flow from game plugins through the application core to the UI
- Integration points with external services (Steam, FACEIT, 5ePlay)
- File system interactions for demo management

##### Important Architectural Patterns

- Event-driven architecture for demo analysis
- MVC pattern in the UI layer
- Repository pattern for data access
- Plugin architecture for game integration

##### Technical Details

- WebSocket communication channels
- Database connections
- File system watchers
- Video processing pipeline
- Demo analysis workflow

##### Implementation Notes

- Clear separation between UI, business logic, and data layers
- Plugin system architecture
- Event handling and state management
- External service integration points
- File processing pipelines

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph UI["Frontend Layer"]
        direction TB
        UI_COMP["UI Components"]
        MATCH["Match Interface"]
        PLAYER["Player Interface"]
        TEAMS["Teams Interface"]
        SETTINGS["Settings Interface"]
        VIDEO_UI["Video Management"]
        WS_CLIENT["WebSocket Client"]
        STATE["State Management"]
    end

    subgraph COMM["IPC/Communication Layer"]
        direction TB
        WS_SERVER["WebSocket Server"]
        IPC["IPC Channels"]
        HANDLERS["Event Handlers"]
    end

    subgraph CORE["Application Core"]
        direction TB
        DEMO["Demo Analysis"]
        VIDEO_GEN["Video Generation"]
        FFMPEG["FFMPEG Integration"]
        HLAE["HLAE Integration"]
    end

    subgraph DATA["Data Layer"]
        direction TB
        DB["Database Operations"]
        FS["File System"]
        STEAM_API["Steam Integration"]
        FACEIT_API["FACEIT Integration"]
        FIVE_API["5ePlay Integration"]
    end

    subgraph NATIVE["Native Integration"]
        direction TB
        CS2["CS2 Plugin"]
        CSGO["CSGO Plugin"]
    end

    %% Relationships
    UI_COMP --> WS_CLIENT
    WS_CLIENT --> WS_SERVER
    WS_SERVER --> HANDLERS
    HANDLERS --> CORE
    CORE --> DATA
    NATIVE --> CORE
    DATA --> CORE
    CORE --> IPC
    IPC --> UI

    %% Click events
    click UI_COMP "https://github.com/akiver/cs-demo-manager/tree/main/src/ui/components"
    click MATCH "https://github.com/akiver/cs-demo-manager/tree/main/src/ui/match"
    click PLAYER "https://github.com/akiver/cs-demo-manager/tree/main/src/ui/player"
    click TEAMS "https://github.com/akiver/cs-demo-manager/tree/main/src/ui/teams"
    click SETTINGS "https://github.com/akiver/cs-demo-manager/tree/main/src/ui/settings"
    click VIDEO_UI "https://github.com/akiver/cs-demo-manager/tree/main/src/ui/videos"
    click WS_CLIENT "https://github.com/akiver/cs-demo-manager/blob/main/src/ui/web-socket-client.ts"
    click WS_SERVER "https://github.com/akiver/cs-demo-manager/tree/main/src/server"
    click HANDLERS "https://github.com/akiver/cs-demo-manager/tree/main/src/server/handlers"
    click IPC "https://github.com/akiver/cs-demo-manager/blob/main/src/common/ipc-channel.ts"
    click DEMO "https://github.com/akiver/cs-demo-manager/tree/main/src/node/demo-analyzer"
    click VIDEO_GEN "https://github.com/akiver/cs-demo-manager/tree/main/src/node/video"
    click FFMPEG "https://github.com/akiver/cs-demo-manager/tree/main/src/node/video/ffmpeg"
    click HLAE "https://github.com/akiver/cs-demo-manager/tree/main/src/node/video/hlae"
    click DB "https://github.com/akiver/cs-demo-manager/tree/main/src/node/database"
    click FS "https://github.com/akiver/cs-demo-manager/tree/main/src/node/filesystem"
    click STEAM_API "https://github.com/akiver/cs-demo-manager/tree/main/src/node/steam-web-api"
    click FACEIT_API "https://github.com/akiver/cs-demo-manager/tree/main/src/node/faceit-web-api"
    click FIVE_API "https://github.com/akiver/cs-demo-manager/tree/main/src/node/5eplay"
    click CS2 "https://github.com/akiver/cs-demo-manager/tree/main/cs2-server-plugin"
    click CSGO "https://github.com/akiver/cs-demo-manager/tree/main/csgo-server-plugin"

    %% Styling
    classDef frontend fill:#3498db,stroke:#2980b9,color:white
    classDef server fill:#2ecc71,stroke:#27ae60,color:white
    classDef core fill:#e74c3c,stroke:#c0392b,color:white
    classDef data fill:#95a5a6,stroke:#7f8c8d,color:white
    classDef native fill:#f1c40f,stroke:#f39c12,color:black
    classDef communication fill:#9b59b6,stroke:#8e44ad,color:white

    class UI_COMP,MATCH,PLAYER,TEAMS,SETTINGS,VIDEO_UI,WS_CLIENT,STATE frontend
    class WS_SERVER,HANDLERS,IPC communication
    class DEMO,VIDEO_GEN,FFMPEG,HLAE core
    class DB,FS,STEAM_API,FACEIT_API,FIVE_API data
    class CS2,CSGO native
```
