# kometa-team/kometa architecture

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

- Interactive diagram: https://gitdiagram.com/kometa-team/kometa
- Repository: https://github.com/kometa-team/kometa

## Overview

##### Main Components

a. Core Components:
- Configuration Management System
- Media Library Manager
- Metadata Processing Engine
- Collection Builder System
- Overlay Management System
- Cache System
- API Integration Hub

b. External Integrations:
- Media Servers (Plex)
- Media Management Tools (Sonarr, Radarr)
- Metadata Sources (TMDb, IMDb, Trakt, etc.)
- Notification Services (Webhooks, Gotify)
- Authentication Systems

**┌─ User Interface Layer ─────────────────────┐**
- Configuration Files                      │
- Command Line Interface                   │
- ┬───────────────────────┘
- ↓
**┌─ Core Processing Layer ───────────────────┐**
- ┌─────────────┐  ┌──────────┐  ┌───────┐ │
- Config     │  │ Library  │  │ Cache │ │
- Manager    │←→│ Manager  │←→│ System│ │
- ┘  └──────────┘  └───────┘ │
- ↕             ↕            ↕      │
- ┌─────────────┐  ┌──────────┐  ┌───────┐ │
- Collection  │  │ Metadata │  │Overlay│ │
- Builder    │←→│ Processor│←→│Manager│ │
- ┘  └──────────┘  └───────┘ │
- ┬───────────────────────┘
- ↓
**┌─ Integration Layer ────────────────────────┐**
- ┌─────────┐ ┌────────┐ ┌───────────────┐  │
- Media   │ │ Media  │ │  Metadata     │  │
- Servers │ │ Mgmt   │ │  Sources      │  │
- ┘ └────────┘ └───────────────┘  │
- ┌─────────────────┐ ┌─────────────────┐   │
- Notification    │ │ Authentication   │   │
- Services        │ │ Services         │   │
- ┘ └─────────────────┘   │
- ┘

##### Key Relationships to Highlight

- Bidirectional data flow between the Library Manager and external media servers
- Configuration Manager's control over all components
- Cache System's interaction with metadata sources
- Collection Builder's dependency on metadata sources
- Overlay Manager's integration with the media library

##### Implementation Details

- Use standardized UML notation for clarity
- Annotations for critical processes
- Version control integration points

##### Documentation Elements

- Component descriptions
- API endpoints
- Configuration dependencies
- Supported external services
- Scaling points

Remember to include version information and note that this represents the current stable architecture, with potential variations in the develop and nightly branches.

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles and Classes
    classDef core fill:#3498db,stroke:#2980b9,color:white
    classDef integration fill:#2ecc71,stroke:#27ae60,color:white
    classDef ui fill:#9b59b6,stroke:#8e44ad,color:white
    classDef support fill:#95a5a6,stroke:#7f8c8d,color:white
    classDef data fill:#e74c3c,stroke:#c0392b,color:white

    %% User Interface Layer
    subgraph UI
        CLI["Command Line Interface"]:::ui
        Config["Configuration Files"]:::ui
    end

    %% Core Processing Layer
    subgraph Core
        ConfigMgr["Configuration Manager"]:::core
        LibMgr["Library Manager"]:::core
        Cache["Cache System"]:::core
        CollBuilder["Collection Builder"]:::core
        MetaProc["Metadata Processor"]:::core
        OverlayMgr["Overlay Manager"]:::core
    end

    %% Integration Layer
    subgraph Integration
        MediaServers["Media Servers"]:::integration
        MediaMgmt["Media Management"]:::integration
        MetaSources["Metadata Sources"]:::integration
        NotifServ["Notification Services"]:::integration
        AuthServ["Authentication Services"]:::integration
    end

    %% Relationships
    CLI --> ConfigMgr
    Config --> ConfigMgr
    ConfigMgr --> LibMgr
    ConfigMgr --> CollBuilder
    ConfigMgr --> MetaProc
    ConfigMgr --> OverlayMgr
    LibMgr <--> Cache
    LibMgr <--> CollBuilder
    LibMgr <--> MetaProc
    LibMgr <--> OverlayMgr
    CollBuilder <--> MetaSources
    MetaProc <--> MetaSources
    Cache <--> MetaSources
    LibMgr <--> MediaServers
    LibMgr <--> MediaMgmt
    MetaProc <--> NotifServ
    AuthServ <--> MediaServers

    %% Click Events
    click ConfigMgr "https://github.com/Kometa-Team/Kometa/blob/master/modules/config.py"
    click LibMgr "https://github.com/Kometa-Team/Kometa/blob/master/modules/library.py"
    click Cache "https://github.com/Kometa-Team/Kometa/blob/master/modules/cache.py"
    click OverlayMgr "https://github.com/Kometa-Team/Kometa/blob/master/modules/overlay.py"
    click CollBuilder "https://github.com/Kometa-Team/Kometa/blob/master/modules/builder.py"
    click MetaProc "https://github.com/Kometa-Team/Kometa/blob/master/modules/meta.py"
    click MediaServers "https://github.com/Kometa-Team/Kometa/blob/master/modules/plex.py"
    click MediaMgmt "https://github.com/Kometa-Team/Kometa/blob/master/modules/radarr.py"
    click MetaSources "https://github.com/Kometa-Team/Kometa/blob/master/modules/tmdb.py"

    %% Legend
    subgraph Legend
        L1["Core Components"]:::core
        L2["Integration Services"]:::integration
        L3["User Interface"]:::ui
        L4["Support Systems"]:::support
    end
```
