# pymedusa/medusa architecture

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

- Interactive diagram: https://gitdiagram.com/pymedusa/medusa
- Repository: https://github.com/pymedusa/medusa

## Overview

Medusa is a self-hosted TV-library manager. Its documented workflow obtains show metadata, searches torrent and Usenet providers, hands selected releases to download clients, then processes and enriches completed media for the library. The graph also preserves the documented episode-management, subtitle, notification, and media-server capabilities. Relationships chiefly follow the README’s workflow description; sampled scheduler and web-handler reference lists support parts of the internal wiring, but most domain implementations were not excerpted.

Main entry points: [`medusa/server/web/home/handler.py`](https://github.com/pymedusa/medusa/blob/master/medusa/server/web/home/handler.py) (Web Interface), [`medusa/process_tv.py`](https://github.com/pymedusa/medusa/blob/master/medusa/process_tv.py) (Post Processing), [`medusa/show/show.py`](https://github.com/pymedusa/medusa/blob/master/medusa/show/show.py) (Show Management), [`medusa/schedulers/download_handler.py`](https://github.com/pymedusa/medusa/blob/master/medusa/schedulers/download_handler.py) (Download Scheduler)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["User Experience"]
  node_webui["Web Interface<br/>[handler.py]"]
  node_frontend["Slim Frontend<br/>[app.js]"]
  node_appcore["Application Core<br/>[app.py]"]
end

subgraph group_catalog["Show Catalog"]
  node_showmgmt["Show Management<br/>[show.py]"]
  node_indexers["Metadata Indexers"]
  node_episodeviews["Episode Views<br/>[handler.py]"]
end

subgraph group_acquisition["Release Acquisition"]
  node_releaseparse["Release Parsing<br/>[parser.py]"]
  node_providers["Search Providers"]
  node_searchflow["Search and Snatch<br/>[handler.py]"]
  node_scheduler["Download Scheduler"]
  node_downloadclients["Download Clients"]
end

subgraph group_library["Library Processing"]
  node_postprocess["Post Processing<br/>[process_tv.py]"]
  node_subtitles["Subtitle Handling<br/>[subtitles.py]"]
  node_mediafiles[("Media Library")]
end

subgraph group_integrations["Integrations"]
  node_mediaindexers["Media Indexers"]
  node_anime["Anime Mappings<br/>[aniDBAbstracter.py]"]
  node_notifiers["Notifications"]
end

node_user(("User"))
node_externalproviders["Provider Services"]
node_externalclient["Download Client"]
node_mediaserver["Media Server"]

node_user -->|"manages shows"| node_webui
node_frontend -.->|"requests actions"| node_webui
node_webui -->|"uses configuration"| node_appcore
node_webui -->|"manages shows"| node_showmgmt
node_showmgmt -->|"retrieves metadata"| node_indexers
node_indexers -->|"returns metadata"| node_showmgmt
node_webui -->|"serves episode views"| node_episodeviews
node_episodeviews -.->|"uses show data"| node_showmgmt
node_searchflow -.->|"parses releases"| node_releaseparse
node_searchflow -->|"searches releases"| node_providers
node_providers -->|"queries"| node_externalproviders
node_webui -->|"starts manual search"| node_searchflow
node_scheduler -->|"searches releases"| node_providers
node_scheduler -->|"dispatches downloads"| node_downloadclients
node_downloadclients -->|"submits release"| node_externalclient
node_scheduler -->|"starts processing"| node_postprocess
node_postprocess -->|"organizes media"| node_mediafiles
node_postprocess -.->|"enriches episodes"| node_subtitles
node_subtitles -.->|"adds subtitles"| node_mediafiles
node_postprocess -->|"updates library"| node_mediaindexers
node_mediaindexers -->|"notifies library"| node_mediaserver
node_showmgmt -->|"maps anime data"| node_anime
node_postprocess -.->|"announces downloads"| node_notifiers
node_notifiers -.->|"sends notifications"| node_mediaserver

click node_webui "https://github.com/pymedusa/medusa/blob/master/medusa/server/web/home/handler.py"
click node_frontend "https://github.com/pymedusa/medusa/blob/master/themes-default/slim/src/app.js"
click node_appcore "https://github.com/pymedusa/medusa/blob/master/medusa/app.py"
click node_showmgmt "https://github.com/pymedusa/medusa/blob/master/medusa/show/show.py"
click node_indexers "https://github.com/pymedusa/medusa/tree/master/medusa/indexers"
click node_episodeviews "https://github.com/pymedusa/medusa/blob/master/medusa/server/web/home/handler.py"
click node_releaseparse "https://github.com/pymedusa/medusa/blob/master/medusa/name_parser/parser.py"
click node_providers "https://github.com/pymedusa/medusa/tree/master/medusa/providers"
click node_searchflow "https://github.com/pymedusa/medusa/blob/master/medusa/server/web/home/handler.py"
click node_scheduler "https://github.com/pymedusa/medusa/blob/master/medusa/schedulers/download_handler.py"
click node_downloadclients "https://github.com/pymedusa/medusa/tree/master/medusa/clients"
click node_postprocess "https://github.com/pymedusa/medusa/blob/master/medusa/process_tv.py"
click node_subtitles "https://github.com/pymedusa/medusa/blob/master/medusa/subtitles.py"
click node_mediaindexers "https://github.com/pymedusa/medusa/tree/master/medusa/indexers"
click node_anime "https://github.com/pymedusa/medusa/blob/master/ext/adba/aniDBAbstracter.py"
click node_notifiers "https://github.com/pymedusa/medusa/tree/master/medusa/notifiers"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_webui,node_frontend,node_appcore,node_user,node_externalclient toneBlue
class node_showmgmt,node_indexers,node_episodeviews toneAmber
class node_releaseparse,node_providers,node_searchflow,node_scheduler,node_downloadclients,node_mediaserver toneMint
class node_postprocess,node_subtitles,node_mediafiles toneRose
class node_mediaindexers,node_anime,node_notifiers,node_externalproviders toneIndigo
```

## Components

### User Experience

- [Web Interface](https://github.com/pymedusa/medusa/blob/master/medusa/server/web/home/handler.py): `medusa/server/web/home/handler.py`
- [Slim Frontend](https://github.com/pymedusa/medusa/blob/master/themes-default/slim/src/app.js): `themes-default/slim/src/app.js`
- [Application Core](https://github.com/pymedusa/medusa/blob/master/medusa/app.py): `medusa/app.py`

### Show Catalog

- [Show Management](https://github.com/pymedusa/medusa/blob/master/medusa/show/show.py): `medusa/show/show.py`
- [Metadata Indexers](https://github.com/pymedusa/medusa/tree/master/medusa/indexers): `medusa/indexers`
- [Episode Views](https://github.com/pymedusa/medusa/blob/master/medusa/server/web/home/handler.py): `medusa/server/web/home/handler.py`

### Release Acquisition

- [Release Parsing](https://github.com/pymedusa/medusa/blob/master/medusa/name_parser/parser.py): `medusa/name_parser/parser.py`
- [Search Providers](https://github.com/pymedusa/medusa/tree/master/medusa/providers): `medusa/providers`
- [Search and Snatch](https://github.com/pymedusa/medusa/blob/master/medusa/server/web/home/handler.py): `medusa/server/web/home/handler.py`
- [Download Scheduler](https://github.com/pymedusa/medusa/blob/master/medusa/schedulers/download_handler.py): `medusa/schedulers/download_handler.py`
- [Download Clients](https://github.com/pymedusa/medusa/tree/master/medusa/clients): `medusa/clients`

### Library Processing

- [Post Processing](https://github.com/pymedusa/medusa/blob/master/medusa/process_tv.py): `medusa/process_tv.py`
- [Subtitle Handling](https://github.com/pymedusa/medusa/blob/master/medusa/subtitles.py): `medusa/subtitles.py`
- **Media Library**

### Integrations

- [Media Indexers](https://github.com/pymedusa/medusa/tree/master/medusa/indexers): `medusa/indexers`
- [Anime Mappings](https://github.com/pymedusa/medusa/blob/master/ext/adba/aniDBAbstracter.py): `ext/adba/aniDBAbstracter.py`
- [Notifications](https://github.com/pymedusa/medusa/tree/master/medusa/notifiers): `medusa/notifiers`

### Other components

- **User**
- **Provider Services**
- **Download Client**
- **Media Server**

## Connections

- User → Web Interface: manages shows (evidence: `README.md`)
- Slim Frontend → Web Interface: requests actions
- Web Interface → Application Core: uses configuration (evidence: `medusa/server/web/home/handler.py`)
- Web Interface → Show Management: manages shows (evidence: `medusa/server/web/home/handler.py`)
- Show Management → Metadata Indexers: retrieves metadata (evidence: `README.md`)
- Metadata Indexers → Show Management: returns metadata (evidence: `README.md`)
- Web Interface → Episode Views: serves episode views (evidence: `medusa/server/web/home/handler.py`)
- Episode Views → Show Management: uses show data (evidence: `medusa/server/web/home/handler.py`)
- Search and Snatch → Release Parsing: parses releases
- Search and Snatch → Search Providers: searches releases (evidence: `README.md`)
- Search Providers → Provider Services: queries (evidence: `README.md`)
- Web Interface → Search and Snatch: starts manual search (evidence: `medusa/server/web/home/handler.py`)
- Download Scheduler → Search Providers: searches releases (evidence: `medusa/schedulers/download_handler.py`)
- Download Scheduler → Download Clients: dispatches downloads (evidence: `medusa/schedulers/download_handler.py`)
- Download Clients → Download Client: submits release (evidence: `README.md`)
- Download Scheduler → Post Processing: starts processing (evidence: `medusa/schedulers/download_handler.py`)
- Post Processing → Media Library: organizes media (evidence: `README.md`)
- Post Processing → Subtitle Handling: enriches episodes
- Subtitle Handling → Media Library: adds subtitles
- Post Processing → Media Indexers: updates library (evidence: `README.md`)
- Media Indexers → Media Server: notifies library (evidence: `README.md`)
- Show Management → Anime Mappings: maps anime data (evidence: `README.md`)
- Post Processing → Notifications: announces downloads
- Notifications → Media Server: sends notifications
