# limmer55/streamdock architecture

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

- Interactive diagram: https://gitdiagram.com/limmer55/streamdock
- Repository: https://github.com/limmer55/streamdock

## Overview

##### Main Components
- Backend Web Server: Represent this as a containerized Python application that handles incoming HTTP requests. Key files such as app/__init__.py, app/routes.py, and app/m3u_parser.py indicate business logic and routing.
- Frontend UI: Break this into two parts:
- Templates – HTML files (e.g., index.html, settings.html)
- Static Assets – CSS, images, and JSON files (e.g., styles.css, countries.json, site.webmanifest) that drive the user interface.
- Configuration/Data: Show configuration files like channels.json, config_template.json, and the static data files. They play a role in channel listing and country data provision.
- Containerization & Deployment: Include the Dockerfile and .dockerignore under source, as well as the deployment scripts/instructions (Docker commands and Docker Compose) and the GitHub Actions workflows that build and push images.
- External Interfaces/Dependencies: Indicate the external IPTV playlist URL (from iptv-org) that may be used by the service when a M3U URL isn’t set locally, as well as any planned transcoding or hardware acceleration in the roadmap.

##### Relationships and Interactions
- How HTTP requests from the client’s browser hit the containerized Python backend.
- Backend rendering dynamic HTML views (using the templates) and serving static files.
- Configuration’s role (e.g., M3U_URL can be set via environment variables or using the settings page provided by the templates).

##### Architectural Patterns & Design Principles
- MVC-Like Separation: Although not strictly “model-view-controller,” the project clearly separates concerns—routing and logic in the backend (controllers), HTML in the templates, and assets in the static folder.
- Containerized Deployment: Highlight that the application is built to run in Docker containers, which decouples development, testing, and production environments.
- CI/CD Integration: Make a node representing continuous integration/deployment via GitHub Actions monitoring build-and-push workflows.

##### Technology and Tools
- Python (likely Flask) as the web framework.
- HTML/CSS (and possibly JavaScript, if added later) for client-side rendering.
- Docker for containerization.
- GitHub Actions for CI/CD.
- External IPTV playlist integration from iptv-org.

##### Final Advice
- Keep the labels clear and the flow of data/dependencies well marked to facilitate easy understanding for maintenance or future enhancements.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Client
    B["Client Browser"]:::client

    %% Backend Subgraph
    subgraph "Backend"
        R["Run Script (run.py)"]:::backend
        A["Python App (Flask)"]:::backend
        R -->|"starts"| A
    end

    %% Frontend UI Subgraph
    subgraph "Frontend UI"
        T["Templates (HTML Views)"]:::frontend
        S["Static Assets (CSS,JS,Images)"]:::frontend
    end

    %% Configuration/Data Subgraph
    subgraph "Configuration/Data"
        C1["Channels Config (channels.json)"]:::config
        C2["Config Template (config_template.json)"]:::config
    end

    %% Containerization & Deployment Subgraph
    subgraph "Containerization & Deployment"
        %% Containerization Subgraph
        subgraph "Containerization"
            DF["Dockerfile"]:::container
            DIgnore[".dockerignore"]:::container
        end
        %% CI/CD Pipeline Subgraph
        subgraph "CI/CD Pipeline"
            W1["build-and-push-main.yml"]:::cicd
            W2["build-and-push-testing.yml"]:::cicd
            W3["manual_build.yml"]:::cicd
            G["GitHub Actions"]:::cicd
            W1 --> G
            W2 --> G
            W3 --> G
        end
        G --> D["Docker Container"]:::container
        D --> A
    end

    %% External Dependency
    E["External IPTV Playlist (iptv-org)"]:::external

    %% Connections
    B -->|"HTTPRequest"| A
    A -->|"renders"| T
    A -->|"serves"| S
    A -->|"reads"| C1
    A -->|"reads"| C2
    A -->|"fetches"| E

    %% Click Events
    click A "https://github.com/limmer55/streamdock/tree/main/source/app"
    click R "https://github.com/limmer55/streamdock/blob/main/source/run.py"
    click T "https://github.com/limmer55/streamdock/tree/main/source/templates"
    click S "https://github.com/limmer55/streamdock/tree/main/source/static"
    click C1 "https://github.com/limmer55/streamdock/blob/main/source/channels.json"
    click C2 "https://github.com/limmer55/streamdock/blob/main/source/config_template.json"
    click DF "https://github.com/limmer55/streamdock/tree/main/source/Dockerfile"
    click DIgnore "https://github.com/limmer55/streamdock/blob/main/source/.dockerignore"
    click W1 "https://github.com/limmer55/streamdock/blob/main/.github/workflows/build-and-push-main.yml"
    click W2 "https://github.com/limmer55/streamdock/blob/main/.github/workflows/build-and-push-testing.yml"
    click W3 "https://github.com/limmer55/streamdock/blob/main/.github/workflows/manual_build.yml"
    click G "https://github.com/limmer55/streamdock/tree/main/.github/workflows"

    %% Styles
    classDef client fill:#ffd1d1,stroke:#333,stroke-width:2px;
    classDef backend fill:#f9e79f,stroke:#333,stroke-width:2px;
    classDef frontend fill:#aed6f1,stroke:#333,stroke-width:2px;
    classDef config fill:#a9dfbf,stroke:#333,stroke-width:2px;
    classDef container fill:#f5b7b1,stroke:#333,stroke-width:2px;
    classDef cicd fill:#d2b4de,stroke:#333,stroke-width:2px;
    classDef external fill:#fcf3cf,stroke:#333,stroke-width:2px;
```
