# idleendeavor/ravebsd architecture

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

- Interactive diagram: https://gitdiagram.com/idleendeavor/ravebsd
- Repository: https://github.com/idleendeavor/ravebsd

## Overview

RaveBSD is a self-hosted book and audiobook search, download, and library server. Users sign in or complete first-run setup, search multiple sources, then download results to the server or send audiobook magnets to qBittorrent; completed files are renamed and made available on a shelf for saving to devices. The graph includes the documented settings, verification, VPN, mirror ranking, and statistics capabilities. Some backend modules were indexed but not excerpted, so their internal relationships are omitted where evidence was insufficient.

Main entry points: [`src/server.js`](https://github.com/idleendeavor/ravebsd/blob/main/src/server.js) (HTTP server), [`public/js/app.js`](https://github.com/idleendeavor/ravebsd/blob/main/public/js/app.js) (App shell), [`src/jobs.js`](https://github.com/idleendeavor/ravebsd/blob/main/src/jobs.js) (Download and shelf jobs), [`src/sources.js`](https://github.com/idleendeavor/ravebsd/blob/main/src/sources.js) (Search and ranking)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Browser app"]
  node_app["App shell<br/>[app.js]"]
  node_searchui["Search interface<br/>[search.js]"]
  node_settingsui["Settings interface<br/>[settings.js]"]
  node_setupui["First-run setup<br/>[setup.js]"]
  node_shelfui["Shelf interface<br/>[shelf.js]"]
  node_ui["Shared browser utilities<br/>[ui.js]"]
end

subgraph group_http["Server and access"]
  node_server["HTTP server<br/>[server.js]"]
  node_auth["Accounts and access<br/>[auth.js]"]
  node_config[("Settings and statistics<br/>[config.js]")]
end

subgraph group_discovery["Search and sources"]
  node_searchcore["Search and ranking<br/>[sources.js]"]
  node_slum["Mirror ranking<br/>[slum.js]"]
  node_browser["Verification browser<br/>[browser.js]"]
end

subgraph group_library["Downloads and library"]
  node_jobs["Download and shelf jobs<br/>[jobs.js]"]
  node_rename["File naming<br/>[rename.js]"]
  node_zip["Archive streaming<br/>[zip.js]"]
end

subgraph group_operations["Runtime services"]
  node_qbit["qBittorrent integration<br/>[qbit.js]"]
  node_vpn["VPN controls<br/>[vpn.js]"]
  node_netguard["Network guard<br/>[netguard.js]"]
end

node_visitor(("User"))
node_booksites{{"Book and audio sources"}}
node_filesystem[("Server book folders")]
node_qbittorrent{{"qBittorrent service"}}
node_gluetun{{"Gluetun VPN"}}

node_visitor -->|"uses"| node_app
node_app -->|"uses"| node_ui
node_app -->|"routes to"| node_searchui
node_app -->|"routes to"| node_shelfui
node_app -->|"routes to"| node_settingsui
node_app -->|"loads"| node_setupui
node_searchui -->|"uses"| node_ui
node_searchui -->|"requests search"| node_server
node_settingsui -->|"updates settings"| node_server
node_shelfui -->|"requests shelf"| node_server
node_server -->|"checks access"| node_auth
node_server -->|"reads and patches"| node_config
node_server -->|"routes search"| node_searchcore
node_server -->|"starts downloads"| node_jobs
node_server -->|"manages verification"| node_browser
node_server -->|"checks VPN"| node_vpn
node_searchcore -->|"searches sources"| node_booksites
node_searchcore -->|"uses browser"| node_browser
node_searchcore -->|"ranks mirrors"| node_slum
node_jobs -->|"resolves links"| node_searchcore
node_jobs -->|"names files"| node_rename
node_jobs -->|"stores downloads"| node_filesystem
node_jobs -->|"dispatches magnets"| node_qbit
node_jobs -.->|"streams archives"| node_zip
node_qbit -->|"sends torrents"| node_qbittorrent
node_vpn -.->|"controls tunnel"| node_gluetun
node_netguard -.->|"guards tunnel use"| node_vpn
node_config -->|"uses naming templates"| node_rename

click node_app "https://github.com/idleendeavor/ravebsd/blob/main/public/js/app.js"
click node_searchui "https://github.com/idleendeavor/ravebsd/blob/main/public/js/search.js"
click node_settingsui "https://github.com/idleendeavor/ravebsd/blob/main/public/js/settings.js"
click node_setupui "https://github.com/idleendeavor/ravebsd/blob/main/public/js/setup.js"
click node_shelfui "https://github.com/idleendeavor/ravebsd/blob/main/public/js/shelf.js"
click node_ui "https://github.com/idleendeavor/ravebsd/blob/main/public/js/ui.js"
click node_server "https://github.com/idleendeavor/ravebsd/blob/main/src/server.js"
click node_auth "https://github.com/idleendeavor/ravebsd/blob/main/src/auth.js"
click node_config "https://github.com/idleendeavor/ravebsd/blob/main/src/config.js"
click node_searchcore "https://github.com/idleendeavor/ravebsd/blob/main/src/sources.js"
click node_slum "https://github.com/idleendeavor/ravebsd/blob/main/src/slum.js"
click node_browser "https://github.com/idleendeavor/ravebsd/blob/main/src/browser.js"
click node_jobs "https://github.com/idleendeavor/ravebsd/blob/main/src/jobs.js"
click node_rename "https://github.com/idleendeavor/ravebsd/blob/main/src/rename.js"
click node_zip "https://github.com/idleendeavor/ravebsd/blob/main/src/zip.js"
click node_qbit "https://github.com/idleendeavor/ravebsd/blob/main/src/qbit.js"
click node_vpn "https://github.com/idleendeavor/ravebsd/blob/main/src/vpn.js"
click node_netguard "https://github.com/idleendeavor/ravebsd/blob/main/src/netguard.js"

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_app,node_searchui,node_settingsui,node_setupui,node_shelfui,node_ui,node_visitor toneBlue
class node_server,node_auth,node_config,node_filesystem toneAmber
class node_searchcore,node_slum,node_browser toneMint
class node_jobs,node_rename,node_zip toneRose
class node_qbit,node_vpn,node_netguard,node_booksites,node_qbittorrent,node_gluetun toneIndigo
```

## Components

### Browser app

- [App shell](https://github.com/idleendeavor/ravebsd/blob/main/public/js/app.js): `public/js/app.js`
- [Search interface](https://github.com/idleendeavor/ravebsd/blob/main/public/js/search.js): `public/js/search.js`
- [Settings interface](https://github.com/idleendeavor/ravebsd/blob/main/public/js/settings.js): `public/js/settings.js`
- [First-run setup](https://github.com/idleendeavor/ravebsd/blob/main/public/js/setup.js): `public/js/setup.js`
- [Shelf interface](https://github.com/idleendeavor/ravebsd/blob/main/public/js/shelf.js): `public/js/shelf.js`
- [Shared browser utilities](https://github.com/idleendeavor/ravebsd/blob/main/public/js/ui.js): `public/js/ui.js`

### Server and access

- [HTTP server](https://github.com/idleendeavor/ravebsd/blob/main/src/server.js): `src/server.js`
- [Accounts and access](https://github.com/idleendeavor/ravebsd/blob/main/src/auth.js): `src/auth.js`
- [Settings and statistics](https://github.com/idleendeavor/ravebsd/blob/main/src/config.js): `src/config.js`

### Search and sources

- [Search and ranking](https://github.com/idleendeavor/ravebsd/blob/main/src/sources.js): `src/sources.js`
- [Mirror ranking](https://github.com/idleendeavor/ravebsd/blob/main/src/slum.js): `src/slum.js`
- [Verification browser](https://github.com/idleendeavor/ravebsd/blob/main/src/browser.js): `src/browser.js`

### Downloads and library

- [Download and shelf jobs](https://github.com/idleendeavor/ravebsd/blob/main/src/jobs.js): `src/jobs.js`
- [File naming](https://github.com/idleendeavor/ravebsd/blob/main/src/rename.js): `src/rename.js`
- [Archive streaming](https://github.com/idleendeavor/ravebsd/blob/main/src/zip.js): `src/zip.js`

### Runtime services

- [qBittorrent integration](https://github.com/idleendeavor/ravebsd/blob/main/src/qbit.js): `src/qbit.js`
- [VPN controls](https://github.com/idleendeavor/ravebsd/blob/main/src/vpn.js): `src/vpn.js`
- [Network guard](https://github.com/idleendeavor/ravebsd/blob/main/src/netguard.js): `src/netguard.js`

### Other components

- **User**
- **Book and audio sources**
- **Server book folders**
- **qBittorrent service**
- **Gluetun VPN**

## Connections

- User → App shell: uses (evidence: `README.md`)
- App shell → Shared browser utilities: uses (evidence: `public/js/app.js`)
- App shell → Search interface: routes to (evidence: `public/js/app.js`)
- App shell → Shelf interface: routes to (evidence: `public/js/app.js`)
- App shell → Settings interface: routes to (evidence: `public/js/app.js`)
- App shell → First-run setup: loads (evidence: `public/js/app.js`)
- Search interface → Shared browser utilities: uses (evidence: `public/js/search.js`)
- Search interface → HTTP server: requests search (evidence: `public/js/search.js`)
- Settings interface → HTTP server: updates settings (evidence: `public/js/settings.js`)
- Shelf interface → HTTP server: requests shelf (evidence: `public/js/shelf.js`)
- HTTP server → Accounts and access: checks access (evidence: `src/server.js`)
- HTTP server → Settings and statistics: reads and patches (evidence: `src/server.js`)
- HTTP server → Search and ranking: routes search (evidence: `src/server.js`)
- HTTP server → Download and shelf jobs: starts downloads (evidence: `src/server.js`)
- HTTP server → Verification browser: manages verification (evidence: `src/server.js`)
- HTTP server → VPN controls: checks VPN (evidence: `src/server.js`)
- Search and ranking → Book and audio sources: searches sources (evidence: `README.md`)
- Search and ranking → Verification browser: uses browser (evidence: `src/sources.js`)
- Search and ranking → Mirror ranking: ranks mirrors (evidence: `src/sources.js`)
- Download and shelf jobs → Search and ranking: resolves links (evidence: `src/jobs.js`)
- Download and shelf jobs → File naming: names files (evidence: `src/jobs.js`)
- Download and shelf jobs → Server book folders: stores downloads (evidence: `README.md`)
- Download and shelf jobs → qBittorrent integration: dispatches magnets (evidence: `src/jobs.js`)
- Download and shelf jobs → Archive streaming: streams archives (evidence: `src/jobs.js`)
- qBittorrent integration → qBittorrent service: sends torrents (evidence: `README.md`)
- VPN controls → Gluetun VPN: controls tunnel
- Network guard → VPN controls: guards tunnel use
- Settings and statistics → File naming: uses naming templates (evidence: `src/config.js`)
