# lgldsilva/jackui architecture

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

- Interactive diagram: https://gitdiagram.com/lgldsilva/jackui
- Repository: https://github.com/lgldsilva/jackui

## Overview

JackUI is a self-hosted torrent-streaming media server with a React web interface and Go backend. The main workflow is search through Jackett, choose a torrent, stream it while pieces download, and optionally transcode it for browser playback. The product also supports local media, downloads, library features, recommendations, authentication, and optional integrations. Relationships follow the README and shown source references; several subsystems are documented but their implementation details were not sampled.

Main entry points: [`cmd/server/routes.go`](https://github.com/lgldsilva/jackui/blob/main/cmd/server/routes.go) (HTTP server), [`web/src/components/PlayerProvider.tsx`](https://github.com/lgldsilva/jackui/blob/main/web/src/components/PlayerProvider.tsx) (Playback interface), [`web/src/api/client.ts`](https://github.com/lgldsilva/jackui/blob/main/web/src/api/client.ts) (Web API client), [`internal/handlers/stream.go`](https://github.com/lgldsilva/jackui/blob/main/internal/handlers/stream.go) (Stream handlers)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["User experience"]
  node_webapp["Web application<br/>[App.tsx]"]
  node_searchui["Search and discover<br/>[SearchPage.tsx]"]
  node_player["Playback interface<br/>[PlayerProvider.tsx]"]
  node_downloadsui["Downloads interface<br/>[DownloadsPage.tsx]"]
  node_authui["Session management<br/>[AuthContext.tsx]"]
  node_api["Web API client<br/>[client.ts]"]
end

subgraph group_discovery["Discovery and library"]
  node_searchhandler["Search handlers<br/>[search.go]"]
  node_library[("Library and history<br/>[store.go]")]
  node_recommend["Recommendations<br/>[recommendations.go]"]
  node_watchlist["Watchlist worker<br/>[worker.go]"]
  node_downloadshandler["Download handlers<br/>[downloads.go]"]
  node_downloadworker["Download worker<br/>[worker.go]"]
end

subgraph group_media["Media delivery"]
  node_streamhandler["Stream handlers<br/>[stream.go]"]
  node_streamer["Torrent streamer<br/>[streamer.go]"]
  node_piececache[("Piece cache<br/>[downloadstorage.go]")]
  node_transcode["Transcode pipeline<br/>[pipeline.go]"]
  node_localmedia["Local media access<br/>[local.go]"]
end

subgraph group_platform["Server platform"]
  node_auth["Authentication<br/>[middleware.go]"]
  node_server["HTTP server<br/>[routes.go]"]
  node_postgres[("PostgreSQL<br/>[pool.go]")]
end

subgraph group_integrations["External integrations"]
  node_jackett["Indexer client<br/>[client.go]"]
  node_ffmpeg["FFmpeg"]
  node_torrent(("BitTorrent swarm"))
  node_electron["Desktop wrapper<br/>[main.ts]"]
  node_tmdb["TMDB metadata<br/>[client.go]"]
  node_opensubtitles["OpenSubtitles<br/>[opensubtitles.go]"]
end

node_user(("Viewer"))

node_user -->|"uses"| node_webapp
node_webapp -->|"opens search"| node_searchui
node_searchui -->|"requests search"| node_api
node_api -->|"calls API"| node_server
node_server -->|"routes requests"| node_searchhandler
node_searchhandler -->|"queries indexers"| node_jackett
node_user -->|"manages downloads"| node_downloadsui
node_downloadsui -->|"requests actions"| node_api
node_server -->|"routes requests"| node_downloadshandler
node_downloadshandler -.->|"manages queue"| node_downloadworker
node_downloadworker -->|"registers downloads"| node_streamer
node_user -->|"starts playback"| node_player
node_player -->|"requests stream"| node_api
node_server -->|"routes streams"| node_streamhandler
node_streamhandler -->|"serves torrent"| node_streamer
node_torrent -->|"provides pieces"| node_streamer
node_streamer -->|"caches pieces"| node_piececache
node_streamhandler -.->|"requests transcode"| node_transcode
node_transcode -->|"runs encoding"| node_ffmpeg
node_streamhandler -->|"streams media"| node_player
node_server -->|"routes local media"| node_localmedia
node_player -->|"plays local files"| node_localmedia
node_authui -->|"authenticates requests"| node_api
node_server -->|"protects routes"| node_auth
node_user -->|"uses library"| node_library
node_watchlist -->|"searches releases"| node_jackett
node_user -->|"views recommendations"| node_recommend
node_server -->|"persists application data"| node_postgres
node_server -.->|"can be bundled by"| node_electron
node_server -->|"enriches metadata"| node_tmdb
node_player -.->|"fetches subtitles"| node_opensubtitles

click node_webapp "https://github.com/lgldsilva/jackui/blob/main/web/src/App.tsx"
click node_searchui "https://github.com/lgldsilva/jackui/blob/main/web/src/pages/SearchPage.tsx"
click node_player "https://github.com/lgldsilva/jackui/blob/main/web/src/components/PlayerProvider.tsx"
click node_downloadsui "https://github.com/lgldsilva/jackui/blob/main/web/src/pages/DownloadsPage.tsx"
click node_authui "https://github.com/lgldsilva/jackui/blob/main/web/src/auth/AuthContext.tsx"
click node_api "https://github.com/lgldsilva/jackui/blob/main/web/src/api/client.ts"
click node_searchhandler "https://github.com/lgldsilva/jackui/blob/main/internal/handlers/search.go"
click node_jackett "https://github.com/lgldsilva/jackui/blob/main/internal/jackett/client.go"
click node_library "https://github.com/lgldsilva/jackui/blob/main/internal/library/store.go"
click node_recommend "https://github.com/lgldsilva/jackui/blob/main/internal/handlers/recommendations.go"
click node_watchlist "https://github.com/lgldsilva/jackui/blob/main/internal/watchlist/worker.go"
click node_downloadshandler "https://github.com/lgldsilva/jackui/blob/main/internal/handlers/downloads.go"
click node_downloadworker "https://github.com/lgldsilva/jackui/blob/main/internal/downloads/worker.go"
click node_streamhandler "https://github.com/lgldsilva/jackui/blob/main/internal/handlers/stream.go"
click node_streamer "https://github.com/lgldsilva/jackui/blob/main/internal/streamer/streamer.go"
click node_piececache "https://github.com/lgldsilva/jackui/blob/main/internal/streamer/downloadstorage.go"
click node_transcode "https://github.com/lgldsilva/jackui/blob/main/internal/transcode/pipeline.go"
click node_localmedia "https://github.com/lgldsilva/jackui/blob/main/internal/handlers/local/local.go"
click node_auth "https://github.com/lgldsilva/jackui/blob/main/internal/auth/middleware.go"
click node_server "https://github.com/lgldsilva/jackui/blob/main/cmd/server/routes.go"
click node_postgres "https://github.com/lgldsilva/jackui/blob/main/internal/db/pool.go"
click node_electron "https://github.com/lgldsilva/jackui/blob/main/electron/main.ts"
click node_tmdb "https://github.com/lgldsilva/jackui/blob/main/internal/tmdb/client.go"
click node_opensubtitles "https://github.com/lgldsilva/jackui/blob/main/internal/subtitles/opensubtitles.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_webapp,node_searchui,node_player,node_downloadsui,node_authui,node_api,node_user toneBlue
class node_searchhandler,node_library,node_recommend,node_watchlist,node_downloadshandler,node_downloadworker toneAmber
class node_streamhandler,node_streamer,node_piececache,node_transcode,node_localmedia toneMint
class node_auth,node_server,node_postgres toneRose
class node_jackett,node_ffmpeg,node_torrent,node_electron,node_tmdb,node_opensubtitles toneIndigo
```

## Components

### User experience

- [Web application](https://github.com/lgldsilva/jackui/blob/main/web/src/App.tsx): `web/src/App.tsx`
- [Search and discover](https://github.com/lgldsilva/jackui/blob/main/web/src/pages/SearchPage.tsx): `web/src/pages/SearchPage.tsx`
- [Playback interface](https://github.com/lgldsilva/jackui/blob/main/web/src/components/PlayerProvider.tsx): `web/src/components/PlayerProvider.tsx`
- [Downloads interface](https://github.com/lgldsilva/jackui/blob/main/web/src/pages/DownloadsPage.tsx): `web/src/pages/DownloadsPage.tsx`
- [Session management](https://github.com/lgldsilva/jackui/blob/main/web/src/auth/AuthContext.tsx): `web/src/auth/AuthContext.tsx`
- [Web API client](https://github.com/lgldsilva/jackui/blob/main/web/src/api/client.ts): `web/src/api/client.ts`

### Discovery and library

- [Search handlers](https://github.com/lgldsilva/jackui/blob/main/internal/handlers/search.go): `internal/handlers/search.go`
- [Library and history](https://github.com/lgldsilva/jackui/blob/main/internal/library/store.go): `internal/library/store.go`
- [Recommendations](https://github.com/lgldsilva/jackui/blob/main/internal/handlers/recommendations.go): `internal/handlers/recommendations.go`
- [Watchlist worker](https://github.com/lgldsilva/jackui/blob/main/internal/watchlist/worker.go): `internal/watchlist/worker.go`
- [Download handlers](https://github.com/lgldsilva/jackui/blob/main/internal/handlers/downloads.go): `internal/handlers/downloads.go`
- [Download worker](https://github.com/lgldsilva/jackui/blob/main/internal/downloads/worker.go): `internal/downloads/worker.go`

### Media delivery

- [Stream handlers](https://github.com/lgldsilva/jackui/blob/main/internal/handlers/stream.go): `internal/handlers/stream.go`
- [Torrent streamer](https://github.com/lgldsilva/jackui/blob/main/internal/streamer/streamer.go): `internal/streamer/streamer.go`
- [Piece cache](https://github.com/lgldsilva/jackui/blob/main/internal/streamer/downloadstorage.go): `internal/streamer/downloadstorage.go`
- [Transcode pipeline](https://github.com/lgldsilva/jackui/blob/main/internal/transcode/pipeline.go): `internal/transcode/pipeline.go`
- [Local media access](https://github.com/lgldsilva/jackui/blob/main/internal/handlers/local/local.go): `internal/handlers/local/local.go`

### Server platform

- [Authentication](https://github.com/lgldsilva/jackui/blob/main/internal/auth/middleware.go): `internal/auth/middleware.go`
- [HTTP server](https://github.com/lgldsilva/jackui/blob/main/cmd/server/routes.go): `cmd/server/routes.go`
- [PostgreSQL](https://github.com/lgldsilva/jackui/blob/main/internal/db/pool.go): `internal/db/pool.go`

### External integrations

- [Indexer client](https://github.com/lgldsilva/jackui/blob/main/internal/jackett/client.go): `internal/jackett/client.go`
- **FFmpeg**
- **BitTorrent swarm**
- [Desktop wrapper](https://github.com/lgldsilva/jackui/blob/main/electron/main.ts): `electron/main.ts`
- [TMDB metadata](https://github.com/lgldsilva/jackui/blob/main/internal/tmdb/client.go): `internal/tmdb/client.go`
- [OpenSubtitles](https://github.com/lgldsilva/jackui/blob/main/internal/subtitles/opensubtitles.go): `internal/subtitles/opensubtitles.go`

### Other components

- **Viewer**

## Connections

- Viewer → Web application: uses (evidence: `README.md`)
- Web application → Search and discover: opens search (evidence: `web/src/App.tsx`)
- Search and discover → Web API client: requests search (evidence: `web/src/api/client.ts`)
- Web API client → HTTP server: calls API (evidence: `README.md`)
- HTTP server → Search handlers: routes requests (evidence: `cmd/server/routes.go`)
- Search handlers → Indexer client: queries indexers (evidence: `README.md`)
- Viewer → Downloads interface: manages downloads (evidence: `README.md`)
- Downloads interface → Web API client: requests actions (evidence: `web/src/api/client.ts`)
- HTTP server → Download handlers: routes requests (evidence: `cmd/server/routes.go`)
- Download handlers → Download worker: manages queue
- Download worker → Torrent streamer: registers downloads (evidence: `internal/downloads/worker.go`)
- Viewer → Playback interface: starts playback (evidence: `README.md`)
- Playback interface → Web API client: requests stream (evidence: `web/src/components/PlayerProvider.tsx`)
- HTTP server → Stream handlers: routes streams (evidence: `cmd/server/routes.go`)
- Stream handlers → Torrent streamer: serves torrent (evidence: `README.md`)
- BitTorrent swarm → Torrent streamer: provides pieces (evidence: `README.md`)
- Torrent streamer → Piece cache: caches pieces (evidence: `README.md`)
- Stream handlers → Transcode pipeline: requests transcode
- Transcode pipeline → FFmpeg: runs encoding (evidence: `README.md`)
- Stream handlers → Playback interface: streams media (evidence: `README.md`)
- HTTP server → Local media access: routes local media (evidence: `cmd/server/routes.go`)
- Playback interface → Local media access: plays local files (evidence: `README.md`)
- Session management → Web API client: authenticates requests (evidence: `web/src/auth/AuthContext.tsx`)
- HTTP server → Authentication: protects routes (evidence: `cmd/server/routes.go`)
- Viewer → Library and history: uses library (evidence: `README.md`)
- Watchlist worker → Indexer client: searches releases (evidence: `internal/watchlist/worker.go`)
- Viewer → Recommendations: views recommendations (evidence: `README.md`)
- HTTP server → PostgreSQL: persists application data (evidence: `README.md`)
- HTTP server → Desktop wrapper: can be bundled by (evidence: `README.md`)
- HTTP server → TMDB metadata: enriches metadata (evidence: `README.md`)
- Playback interface → OpenSubtitles: fetches subtitles (evidence: `README.md`)
