# dalexhd/steamspeak architecture

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

- Interactive diagram: https://gitdiagram.com/dalexhd/steamspeak
- Repository: https://github.com/dalexhd/steamspeak

## Overview

##### Project Overview
- SteamSpeak enables integration between Steam and TeamSpeak. It powers a TeamSpeak3 server by using plugins and automation while offering a VueJS‐powered administration panel.
- It’s organized as a monorepo (using lerna.json) with two main packages: the client (packages/client) and the server (packages/server).

##### Main Components
a. Frontend (VueJS Client)
- Located under packages/client.
- Contains assets, components, layouts, views, and routing.
- Functions as the administration panel through which users log in, view dashboards, manage settings, and trigger server actions.

b. Backend (Node.js Server)
- Located under packages/server.
- Uses TypeScript (note tsconfig.json) and has a modular structure.
- Core modules include:
- Website API: Exposes REST endpoints (e.g., under src/core/Website/api) for authentication, logs, user verification, and widget controllers.
- Authentication & Authorization: Middleware and controllers supporting user and token management.
- Steam Integration: Modules located in src/core/Steam handle Steam data—rich presence, games, friend requests, and related events.
- TeamSpeak Integration: Comprises plugins (under src/core/TeamSpeak/plugins) such as afk kick, afk move, channel change management, and other server automation tasks.
- Core Services: Includes caching (src/core/Cache), database access (src/core/Database with model definitions), events, and utilities.

c. External Dependencies/Services:
- Steam API: For rich presence and other data, which the Steam modules interact with.
- TeamSpeak Server: The target external service where TeamSpeak plugins execute command and automation tasks.

d. Supporting Infrastructure:
- Documentation: Managed in the docs folder using Docusaurus-style layout.
- CI/CD & Deployment: Configured via GitHub Actions, Travis CI, Docker-related files, and various scripts (in the scripts folder).

##### Relationships and Interactions
- The Frontend communicates with the Backend via RESTful API calls (requests routed to controllers under Website API).
- The Backend:
- Receives requests from the client and determines actions (e.g., authentication, updating settings, triggering a plugin).
- Routes relevant requests to its modules: for instance, a request to update team status may involve the Steam module accessing external APIs and the TeamSpeak plugin executing automation.
- Utilizes core components like the Cache and Database to store user data, configurations, and state information.
- The modular design within the backend ensures that Steam integration, TeamSpeak automation, and the Website API are loosely coupled yet interact through well-defined interfaces (e.g., event emitters, middleware).

##### Architectural Patterns and Design Principles
- Separation of concerns: Frontend and Backend are clearly separated, while the backend itself is divided into distinct modules (API, authentication, integration modules, etc.).
- Plugin Architecture: TeamSpeak functionalities are implemented as separate plugins (organized in distinct directories per instance) to ensure extensibility.
- Modularization and Clear API Boundaries: The use of controllers, middlewares, and designated APIs highlight a structured communication pattern within the server.
- Use of modern CI/CD practices and containerization evidenced by configuration files and scripts.

## Diagram (Mermaid)

```mermaid
graph TD
    %% Frontend Section
    subgraph "Frontend (VueJS Client)"
        FE["VueJS Client"]:::frontend
        FE_UI["Administration Panel"]:::frontend
        FE_Auth["Auth Views (Login/Dashboard)"]:::frontend
        FE_Routes["Client-Side Routing & Components"]:::frontend
    end

    %% Backend Section
    subgraph "Backend (Node.js Server)"
        BE["Node.js Server"]:::backend
        %% API Layer
        subgraph "API Layer"
            B_API["Website API Layer"]:::backend
            B_Auth["Authentication & Authorization"]:::backend
        end
        %% Integration Modules
        subgraph "Integration Modules"
            B_Steam["Steam Integration Module"]:::integration
            B_TS["TeamSpeak Plugins"]:::integration
        end
        %% Core Services
        subgraph "Core Services"
            B_Database["Database & Models"]:::backend
            B_Cache["Cache Layer"]:::backend
            B_Event["Event Bus"]:::backend
        end
        B_Util["Utility Modules"]:::backend
    end

    %% External Dependencies
    EX_SteamAPI["Steam API"]:::external
    EX_TeamSpeak["TeamSpeak Server"]:::external

    %% Supporting Infrastructure
    Infra_Docs["Documentation & Guides"]:::infrastructure
    Infra_CICD["CI/CD & Deployment"]:::infrastructure

    %% Frontend Internal Connections
    FE --> FE_UI
    FE --> FE_Auth
    FE --> FE_Routes

    %% Communication between Frontend and Backend
    FE -->|"API_Request"| B_API

    %% Backend Internal Connections
    B_API -->|"AuthCheck"| B_Auth
    B_API -->|"DataFlow"| B_Database
    B_API -->|"DataFlow"| B_Cache
    B_API -->|"Trigger_Steam"| B_Steam
    B_API -->|"Trigger_TeamSpeak"| B_TS
    B_Steam -->|"EventDispatch"| B_Event
    B_TS -->|"EventDispatch"| B_Event

    %% Integration with External Services
    B_Steam -->|"SteamData"| EX_SteamAPI
    B_TS -->|"CommandExec"| EX_TeamSpeak

    %% Deployment Links
    Infra_CICD -->|"Deploys"| FE
    Infra_CICD -->|"Deploys"| BE

    %% Class Definitions for Colouring
    classDef frontend fill:#FFCCCC,stroke:#990000,stroke-width:2px;
    classDef backend fill:#CCFFCC,stroke:#009900,stroke-width:2px;
    classDef integration fill:#FFFFCC,stroke:#999900,stroke-width:2px;
    classDef external fill:#CCE5FF,stroke:#0055CC,stroke-width:2px;
    classDef infrastructure fill:#FFEDCC,stroke:#CC6600,stroke-width:2px;

    %% Click Events for Component Mapping
    click FE "https://github.com/dalexhd/steamspeak/tree/master/packages/client/"
    click BE "https://github.com/dalexhd/steamspeak/tree/master/packages/server/"
    click B_API "https://github.com/dalexhd/steamspeak/tree/master/packages/server/src/core/Website/api/"
    click B_Auth "https://github.com/dalexhd/steamspeak/tree/master/packages/server/src/core/Website/api/middlewares/"
    click B_Steam "https://github.com/dalexhd/steamspeak/tree/master/packages/server/src/core/Steam/"
    click B_TS "https://github.com/dalexhd/steamspeak/tree/master/packages/server/src/core/TeamSpeak/plugins/"
    click B_Database "https://github.com/dalexhd/steamspeak/tree/master/packages/server/src/core/Database/"
    click B_Cache "https://github.com/dalexhd/steamspeak/tree/master/packages/server/src/core/Cache/"
    click Infra_Docs "https://github.com/dalexhd/steamspeak/tree/master/docs/"
    click Infra_CICD "https://github.com/dalexhd/steamspeak/tree/master/.github/workflows/"
```
