Automate the setup and configuration of Sonarr, Radarr, Prowlarr, Bazarr, and qBittorrent β from empty PostgreSQL databases to fully working, connected services.
PrepArr is a Docker sidecar that manages your entire media stack as code. It handles database creation, config file generation, API key setup, download clients, indexers, quality profiles, and subtitle providers β all from JSON files. No setup wizards, no manual clicking, no config drift.
| Service | Status | What it does |
|---|---|---|
| Sonarr | β Fully supported | TV show management |
| Radarr | β Fully supported | Movie management |
| Prowlarr | β Fully supported | Indexer management + sync to Sonarr/Radarr |
| Bazarr | β Fully supported | Subtitle management for Sonarr/Radarr |
| qBittorrent | β Config management | Download client configuration |
PrepArr uses a three-container pattern for each Servarr application:
graph LR
A[Init Container] -->|prepares| B[Shared Volume]
B -->|mounts| C[Servarr App]
B -->|watches| D[Sidecar Container]
E[Config Files] -->|loads| A
E -->|monitors| D
- Init Container - Runs once, sets up databases and config files, then exits
- Servarr/Bazarr App - Standard Linuxserver container using prepared config
- Sidecar Container - Continuously applies your JSON configuration
version: '3.8'
services:
postgres:
image: postgres:16-alpine
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres123
POSTGRES_DB: servarr
# 1. Init Container - Setup databases and config.xml
sonarr-init:
image: ghcr.io/robbeverhelst/preparr:latest
command: ["bun", "run", "dist/index.js", "--init"]
environment:
POSTGRES_HOST: postgres
POSTGRES_PASSWORD: postgres123
SERVARR_URL: http://sonarr:8989
SERVARR_TYPE: sonarr
SERVARR_ADMIN_PASSWORD: adminpass
CONFIG_PATH: /config/sonarr-config.json
volumes:
- sonarr_config:/config
- ./sonarr-config.json:/config/sonarr-config.json:ro
depends_on: [postgres]
# 2. Servarr App - Standard container
sonarr:
image: linuxserver/sonarr:latest
ports: ["8989:8989"]
volumes:
- sonarr_config:/config
- ./tv:/tv
- ./downloads:/downloads
depends_on:
sonarr-init:
condition: service_completed_successfully
# 3. Sidecar - Continuous configuration management
sonarr-sidecar:
image: ghcr.io/robbeverhelst/preparr:latest
environment:
POSTGRES_HOST: postgres
POSTGRES_PASSWORD: postgres123
SERVARR_URL: http://sonarr:8989
SERVARR_TYPE: sonarr
SERVARR_ADMIN_PASSWORD: adminpass
CONFIG_PATH: /config/sonarr-config.json
CONFIG_WATCH: "true"
HEALTH_PORT: 9001
ports: ["9001:9001"]
volumes:
- sonarr_config:/config
- ./sonarr-config.json:/config/sonarr-config.json:ro
depends_on: [sonarr]
volumes:
sonarr_config:Define your entire Servarr setup as code:
{
"apiKey": "2bac5d00dca43258313c734821a15c4c",
"prowlarrSync": true,
"rootFolders": [
{
"path": "/tv",
"accessible": true
}
],
"qualityProfiles": [
{
"name": "HD - 1080p",
"cutoff": 1080,
"items": [
{
"quality": { "id": 1, "name": "HDTV-1080p" },
"allowed": true
},
{
"quality": { "id": 2, "name": "WEBDL-1080p" },
"allowed": true
}
]
}
],
"downloadClients": [
{
"name": "qBittorrent",
"implementation": "QBittorrent",
"implementationName": "qBittorrent",
"configContract": "QBittorrentSettings",
"fields": [
{ "name": "host", "value": "qbittorrent" },
{ "name": "port", "value": 8080 },
{ "name": "username", "value": "admin" },
{ "name": "password", "value": "adminpass" },
{ "name": "category", "value": "tv" }
],
"enable": true,
"priority": 1
}
]
}prowlarrSync - Set to true to allow Prowlarr to manage indexers automatically via application sync. When enabled, the sidecar skips indexer management to prevent conflicts with Prowlarr's indexer synchronization.
true- Prowlarr manages indexers (recommended for multi-service setups)false- Sidecar manages indexers directly via config file (default)
For complete Prowlarr + Sonarr + Radarr + Bazarr stack, see our docker-compose.test.yml which includes:
- Prowlarr managing indexers and syncing to Sonarr/Radarr
- Sonarr for TV shows with automatic download client setup
- Radarr for movies with shared qBittorrent client
- Bazarr for subtitles, linked to Sonarr and Radarr
- qBittorrent configured automatically by PrepArr
- Shared PostgreSQL database for all services
Each service gets its own init + sidecar containers managing separate config files.
- Database Setup: Creates PostgreSQL databases and users
- Config Generation: Creates config.xml with database credentials and API keys
- API Key Management: Generates or uses provided API keys
- Initial Configuration: Applies your JSON config for first boot
- Exits: Lets the main Servarr container start with prepared config
- Waits: For Servarr application to be ready
- Monitors: JSON configuration files for changes
- Reconciles: Applies configuration via Servarr APIs
- Health: Exposes /health and /ready endpoints
- Repeats: Continuous monitoring and drift correction
- Zero Manual Setup - Fresh deployments boot directly to configured state
- Configuration as Code - Version control your entire media stack
- Truly Stateless - Eliminates persistent config volumes, Servarr apps become ephemeral
- Drift Prevention - Sidecar ensures config stays as specified
- GitOps Ready - Update configs via git, automatic deployment
- Multi-Service - Coordinate complex Prowlarr + Sonarr + Radarr + Bazarr setups
# Install the complete stack
helm install my-media-stack oci://ghcr.io/robbeverhelst/charts/preparr --version <version>
# Or with custom values
helm install my-media-stack oci://ghcr.io/robbeverhelst/charts/preparr --version <version> -f custom-values.yamlFind the chart on ArtifactHub or see the Helm chart documentation.
See examples above and in examples/ directory.
Use the Helm chart or manual manifests with init containers + sidecars + ConfigMaps.
- Health Checks -
/healthand/readyendpoints for orchestrators - Observability - Structured JSON logging with correlation IDs
- Configuration Validation - Zod schema validation prevents bad configs
- Error Recovery - Automatic retry with exponential backoff
- Signal Handling - Graceful shutdown on SIGTERM/SIGINT
- Security - Runs as non-root, secrets via environment variables
Full documentation is available at robbeverhelst.github.io/Preparr.
- Quick Start - Get up and running
- Deployment Guides - Docker Compose, Kubernetes, Helm
- Configuration Reference - All configuration options
- Troubleshooting - Common issues and solutions
We welcome contributions! Please see our Contributing Guide for development setup and guidelines.
MIT License - see LICENSE file for details.
Infrastructure as Code for Servarr β’ Examples β β’ GitHub Packages β