# lersveen/qpsync architecture

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

- Interactive diagram: https://gitdiagram.com/lersveen/qpsync
- Repository: https://github.com/lersveen/qpsync

## Overview

##### Main Components

a) Core Components:
- qpsync Service (Central Component)
- qBittorrent Web UI
- Gluetun VPN Client
- Configuration System

b) External Interfaces:
- Port Forward File (Optional Input)
- Environment Variables
- YAML Configuration

##### Component Relationships

a) Primary Flow:
- Qpsync in the center
- QBittorrent on the right as the target system
- Configuration sources at the top

b) Data Flow Directions:
- Configuration input flows from both YAML and env vars

##### Specific Implementation Details

- Rectangles for main services (qpsync, qBittorrent, Gluetun)

##### Technical Specifications

Key technical details:
- REST API connections between components
- Port forwarding mechanism
- Configuration parameters
- Update frequency timing (default 300s)

##### Component Details

- Service name
- Protocol used (HTTP/REST)
- Default ports
- Configuration parameters

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Configuration
        ENV[Environment Variables]
        YAML["Configuration YAML"]:::config
        PF["Port Forward File<br>(Optional)"]
    end

    subgraph VPN
        GL["Gluetun VPN Client"]
        PORT[Port Information]
    end

    subgraph Core
        QPS["qpsync Service"]:::core
    end

    subgraph Client
        QB["qBittorrent Web UI"]
    end

    %% Data Flow
    ENV --> QPS
    YAML --> QPS
    PF -.-> QPS
    GL --> PORT
    PORT --> QPS
    QPS --> |"REST API<br>Port Updates"| QB

    %% Timing
    UPDATE["Update Interval:<br>300s (default)"]
    UPDATE -.-> QPS

    %% Legend
    subgraph Legend
        L1["Required Connection"]
        L2[/"Optional Connection"/]
        L3["Configuration Source"]
        L4["Service Component"]
    end

    %% Styling
    classDef core fill:#f9f,stroke:#333,stroke-width:2px;
    classDef config fill:#ff9,stroke:#333,stroke-width:1px;

    %% Click Events
    click QPS "https://github.com/lersveen/qpsync/blob/main/main.go"
    click YAML "https://github.com/lersveen/qpsync/blob/main/config-example.yaml"

    %% Notes
    style Legend fill:#f5f5f5,stroke:#333,stroke-width:1px
    style UPDATE fill:#e1e1e1,stroke:#333,stroke-width:1px
```
