# shsharkar/stremio-real-debrid-addon architecture

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

- Interactive diagram: https://gitdiagram.com/shsharkar/stremio-real-debrid-addon
- Repository: https://github.com/shsharkar/stremio-real-debrid-addon

## Overview

##### Client-Side Components
- Stremio Client Application
- Addon Configuration Interface (HTML/CSS frontend using Tailwind)

##### Server-Side Components
- Node.js Server (server.js)
- Addon Core Logic (addon.js)

##### External Services
- Real Debrid API
- TMDb API (Optional)
- OMDb API (Optional)

##### Component Representation

a. Client Layer:

b. Server Layer:
- Sub-components:
- Addon Core Logic
- Stream Management
- Metadata Handler

c. External Services Layer:

##### Additional Elements

a. Data flow annotations:
- Stream requests
- API authentication
- Metadata requests

b. Technical specifications:
- Port numbers (62316)
- API endpoints
- Supported content types (Movies/Series)

##### Technical Details to Note
- Node.js runtime environment
- Tailwind CSS for styling
- Docker containerization
- API key requirements
- Port configurations

Remember to:
- Version information
- Clear labels for all components
- Error handling paths
- Scalability points

##### Optional metadata enhancement flow

This system design should provide a clear understanding of how the addon integrates with both Stremio and Real Debrid while maintaining a clean separation of concerns and clear data flow paths.

## Diagram (Mermaid)

```mermaid
%%{init: {'theme': 'base', 'themeVariables': { 'primaryColor': '#4f6d7a', 'primaryTextColor': '#fff', 'primaryBorderColor': '#4f6d7a', 'lineColor': '#4f6d7a', 'secondaryColor': '#6c8896', 'tertiaryColor': '#637c8a'}}}%%

flowchart TB
    subgraph Client["Client Layer"]
        SC[Stremio Client]
        CI["Configuration Interface"]:::frontend
    end

    subgraph Server["Server Layer"]
        direction TB
        subgraph Docker["Docker Container"]
            direction TB
            NS["Node.js Server"]:::server
            ACL["Addon Core Logic"]:::server
            SM["Stream Management"]
            MH["Metadata Handler"]
        end
    end

    subgraph External["External Services Layer"]
        RD["Real Debrid API"]:::api
        TMDB["TMDb API"]:::api
        OMDB["OMDb API"]:::api
    end

    %% Connections
    SC <--> NS
    CI <--> NS
    NS <--> ACL
    ACL <--> SM
    ACL <--> MH
    SM <--> RD
    MH -.-> TMDB
    MH -.-> OMDB

    %% Styling
    classDef frontend fill:#4299E1,stroke:#2B6CB0,stroke-width:2px
    classDef server fill:#48BB78,stroke:#2F855A,stroke-width:2px
    classDef api fill:#9F7AEA,stroke:#6B46C1,stroke-width:2px

    %% Click events
    click NS "https://github.com/SHSharkar/Stremio-Real-Debrid-Addon/blob/main/server.js"
    click ACL "https://github.com/SHSharkar/Stremio-Real-Debrid-Addon/blob/main/addon.js"
    click CI "https://github.com/SHSharkar/Stremio-Real-Debrid-Addon/blob/main/configure.html"
    click Docker "https://github.com/SHSharkar/Stremio-Real-Debrid-Addon/tree/main/Dockerfile"

    %% Legend
    subgraph Legend
        direction TB
        L1["Frontend Component"]:::frontend
        L2["Server Component"]:::server
        L3["External API"]:::api
        L4[" Primary Flow"] --> L5[" "]
        L6[" Optional Flow"] -.-> L7[" "]
    end
```
