# Architecture Diagram

> How the Plex media stack components connect, where data flows, and which paths are shared between services.

# Architecture Diagram

## Component Overview

![Media Stack Architecture Diagram](/assets/docs/architecture-media-stack.svg)

> **How to read this diagram:** The user requests content through Seerr (the request portal). Seerr forwards to Sonarr/Radarr, which query Prowlarr for indexer results and then hand the download to SABnzbd. SABnzbd downloads files to `/mnt/downloads`, and Sonarr/Radarr import them into the media library on the ZFS pool. Plex reads from that same pool and streams back to the user.
>
> **Focal services** (thick border) are user-facing. **Dashed lines** represent external/remote connections. Everything else runs locally on the Proxmox host.

## Data Flow

```
User
└─► Seerr (request)
    └─► Sonarr / Radarr (pick release, apply quality profile)
        └─► Prowlarr (search indexers)
            └─► SABnzbd (download + unpack to /mnt/downloads)
                └─► Sonarr / Radarr (import → /mnt/media/tv or /mnt/media/movies)
                    └─► Plex (detects new file, scans library, ready to stream)
```

## Storage Paths

| Path | Used by | Description |
|------|---------|-------------|
| `/mnt/media/movies` | Radarr, Plex | Final movie library |
| `/mnt/media/tv` | Sonarr, Plex | Final TV show library |
| `/mnt/downloads` | SABnzbd, Sonarr, Radarr | Download staging area |

All three paths come from the same ZFS pool. Sonarr and Radarr see both `/mnt/downloads` and `/mnt/media` — this allows them to move files (instant rename) during import instead of copying across filesystems.

## VM and LXC IDs

| ID | Type | Service |
|----|------|---------|
| `lxc/103` | LXC | Plex Media Server |
| `lxc/104` | LXC | n8n |
| `qemu/102` | VM | Docker host — Sonarr, Radarr, SABnzbd, Seerr |
| `node/proxmox` | Host | Proxmox VE node |

## Network

All Docker containers run on a shared internal network (`media_net`). They communicate by container name, not by port or IP. The only ports exposed to the LAN are the web UIs of each service.

| Service | LAN Port |
|---------|----------|
| Plex | 32400 |
| Seerr | 5055 |
| Sonarr | 8989 |
| Radarr | 7878 |
| Prowlarr | 9696 |
| SABnzbd | 8080 |

None of these are exposed to the internet by default. Remote access to Plex is handled by Plex's own relay service.
