# autobrr/qui architecture

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

- Interactive diagram: https://gitdiagram.com/autobrr/qui
- Repository: https://github.com/autobrr/qui

## Overview

qui is a self-hosted web interface for managing multiple qBittorrent instances. Users interact with its web UI, whose API exposes torrent management and supporting workflows; the backend synchronizes with qBittorrent and runs cross-seeding, automations, backups, and scans. The CLI starts and wires the application, while persistent stores, event streaming, indexer integrations, and the reverse proxy support those workflows. The README and source index establish the major capabilities and many wiring references; some unsampled implementation details are intentionally represented only at subsystem level.

Main entry points: [`internal/api/server.go`](https://github.com/autobrr/qui/blob/develop/internal/api/server.go) (HTTP API), [`cmd/qui/main.go`](https://github.com/autobrr/qui/blob/develop/cmd/qui/main.go) (Application startup), [`web/src/App.tsx`](https://github.com/autobrr/qui/blob/develop/web/src/App.tsx) (Web interface), [`internal/qbittorrent/sync_manager.go`](https://github.com/autobrr/qui/blob/develop/internal/qbittorrent/sync_manager.go) (Client synchronization)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Application and API"]
  node_webui["Web interface<br/>[App.tsx]"]
  node_cli["Application startup<br/>[main.go]"]
  node_api["HTTP API<br/>[server.go]"]
  node_events["Live event stream<br/>[manager.go]"]
end

subgraph group_torrent["Torrent operations"]
  node_sync["Client synchronization<br/>[sync_manager.go]"]
  node_qbit["qBittorrent instances"]
  node_proxy["Reverse proxy<br/>[handler.go]"]
end

subgraph group_workflow["Automation workflows"]
  node_crossseed["Cross-seeding"]
  node_automation["Rule automations<br/>[service.go]"]
  node_dirscan["Directory scans<br/>[service.go]"]
  node_orphans["Orphan scans<br/>[service.go]"]
  node_backup["Backup and restore<br/>[service.go]"]
end

subgraph group_support["Persistence and integrations"]
  node_indexers["Indexer search<br/>[service.go]"]
  node_prowlarr["Prowlarr client<br/>[client.go]"]
  node_notifications["Notifications<br/>[service.go]"]
  node_database[("Application database<br/>[db.go]")]
end

node_operator(("User"))

node_operator -->|"uses"| node_webui
node_webui -.->|"requests"| node_api
node_cli -->|"starts"| node_api
node_api -->|"routes streams"| node_events
node_api -->|"routes operations"| node_sync
node_sync -->|"synchronizes"| node_qbit
node_api -->|"routes proxy"| node_proxy
node_cli -->|"initializes"| node_database
node_api -->|"routes workflows"| node_crossseed
node_api -->|"routes workflows"| node_automation
node_api -->|"routes scans"| node_dirscan
node_api -->|"routes scans"| node_orphans
node_api -->|"routes backups"| node_backup
node_api -->|"routes indexers"| node_indexers
node_indexers -->|"searches through"| node_prowlarr
node_cli -->|"starts service"| node_notifications
node_cli -->|"starts automation"| node_crossseed
node_cli -->|"configures service"| node_automation
node_cli -->|"configures service"| node_dirscan
node_cli -->|"configures service"| node_backup

click node_webui "https://github.com/autobrr/qui/blob/develop/web/src/App.tsx"
click node_cli "https://github.com/autobrr/qui/blob/develop/cmd/qui/main.go"
click node_api "https://github.com/autobrr/qui/blob/develop/internal/api/server.go"
click node_events "https://github.com/autobrr/qui/blob/develop/internal/api/sse/manager.go"
click node_sync "https://github.com/autobrr/qui/blob/develop/internal/qbittorrent/sync_manager.go"
click node_proxy "https://github.com/autobrr/qui/blob/develop/internal/proxy/handler.go"
click node_crossseed "https://github.com/autobrr/qui/tree/develop/internal/services/crossseed"
click node_automation "https://github.com/autobrr/qui/blob/develop/internal/services/automations/service.go"
click node_dirscan "https://github.com/autobrr/qui/blob/develop/internal/services/dirscan/service.go"
click node_orphans "https://github.com/autobrr/qui/blob/develop/internal/services/orphanscan/service.go"
click node_backup "https://github.com/autobrr/qui/blob/develop/internal/backups/service.go"
click node_indexers "https://github.com/autobrr/qui/blob/develop/internal/services/jackett/service.go"
click node_prowlarr "https://github.com/autobrr/qui/blob/develop/pkg/prowlarr/client.go"
click node_notifications "https://github.com/autobrr/qui/blob/develop/internal/services/notifications/service.go"
click node_database "https://github.com/autobrr/qui/blob/develop/internal/database/db.go"

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_cli,node_api,node_events,node_operator toneBlue
class node_sync,node_qbit,node_proxy toneAmber
class node_crossseed,node_automation,node_dirscan,node_orphans,node_backup toneMint
class node_indexers,node_prowlarr,node_notifications,node_database toneRose
```

## Components

### Application and API

- [Web interface](https://github.com/autobrr/qui/blob/develop/web/src/App.tsx): `web/src/App.tsx`
- [Application startup](https://github.com/autobrr/qui/blob/develop/cmd/qui/main.go): `cmd/qui/main.go`
- [HTTP API](https://github.com/autobrr/qui/blob/develop/internal/api/server.go): `internal/api/server.go`
- [Live event stream](https://github.com/autobrr/qui/blob/develop/internal/api/sse/manager.go): `internal/api/sse/manager.go`

### Torrent operations

- [Client synchronization](https://github.com/autobrr/qui/blob/develop/internal/qbittorrent/sync_manager.go): `internal/qbittorrent/sync_manager.go`
- **qBittorrent instances**
- [Reverse proxy](https://github.com/autobrr/qui/blob/develop/internal/proxy/handler.go): `internal/proxy/handler.go`

### Automation workflows

- [Cross-seeding](https://github.com/autobrr/qui/tree/develop/internal/services/crossseed): `internal/services/crossseed`
- [Rule automations](https://github.com/autobrr/qui/blob/develop/internal/services/automations/service.go): `internal/services/automations/service.go`
- [Directory scans](https://github.com/autobrr/qui/blob/develop/internal/services/dirscan/service.go): `internal/services/dirscan/service.go`
- [Orphan scans](https://github.com/autobrr/qui/blob/develop/internal/services/orphanscan/service.go): `internal/services/orphanscan/service.go`
- [Backup and restore](https://github.com/autobrr/qui/blob/develop/internal/backups/service.go): `internal/backups/service.go`

### Persistence and integrations

- [Indexer search](https://github.com/autobrr/qui/blob/develop/internal/services/jackett/service.go): `internal/services/jackett/service.go`
- [Prowlarr client](https://github.com/autobrr/qui/blob/develop/pkg/prowlarr/client.go): `pkg/prowlarr/client.go`
- [Notifications](https://github.com/autobrr/qui/blob/develop/internal/services/notifications/service.go): `internal/services/notifications/service.go`
- [Application database](https://github.com/autobrr/qui/blob/develop/internal/database/db.go): `internal/database/db.go`

### Other components

- **User**

## Connections

- User → Web interface: uses (evidence: `README.md`)
- Web interface → HTTP API: requests
- Application startup → HTTP API: starts (evidence: `cmd/qui/main.go`)
- HTTP API → Live event stream: routes streams (evidence: `internal/api/server.go`)
- HTTP API → Client synchronization: routes operations (evidence: `internal/api/server.go`)
- Client synchronization → qBittorrent instances: synchronizes (evidence: `internal/qbittorrent/sync_manager.go`)
- HTTP API → Reverse proxy: routes proxy (evidence: `internal/api/server.go`)
- Application startup → Application database: initializes (evidence: `cmd/qui/main.go`)
- HTTP API → Cross-seeding: routes workflows (evidence: `internal/api/server.go`)
- HTTP API → Rule automations: routes workflows (evidence: `internal/api/server.go`)
- HTTP API → Directory scans: routes scans (evidence: `internal/api/server.go`)
- HTTP API → Orphan scans: routes scans (evidence: `internal/api/server.go`)
- HTTP API → Backup and restore: routes backups (evidence: `internal/api/server.go`)
- HTTP API → Indexer search: routes indexers (evidence: `internal/api/server.go`)
- Indexer search → Prowlarr client: searches through (evidence: `internal/services/jackett/service.go`)
- Application startup → Notifications: starts service (evidence: `cmd/qui/main.go`)
- Application startup → Cross-seeding: starts automation (evidence: `cmd/qui/main.go`)
- Application startup → Rule automations: configures service (evidence: `cmd/qui/main.go`)
- Application startup → Directory scans: configures service (evidence: `cmd/qui/main.go`)
- Application startup → Backup and restore: configures service (evidence: `cmd/qui/main.go`)
