Posterizarr - LLM Project & Architecture Guide
Purpose: This file provides immediate, structured context for Large Language Models (LLMs) and AI agents. Read this file first to understand the codebase architecture, key components, configuration schemas, and common conventions without scanning the entire repository.
1. Project Overview & Mission
Posterizarr is an automated artwork processing, overlay generation, and metadata synchronization engine for personal media servers (Plex, Jellyfin, and Emby).
Primary Capabilities:
- Scrapes Artwork: Queries multiple metadata providers (TMDB, TVDB, Fanart.tv, and local media servers) using granular language and priority preferences.
- Generates Overlays: Uses ImageMagick 7 to dynamically composite overlays (borders, gradients, resolution banners like 4K/HDR/Dolby Vision, audio codec badges, source watermarks) onto posters, season posters, backgrounds, and title cards.
- Uploads to Media Servers: Uploads processed artwork directly to Plex, Jellyfin, or Emby via API.
- Web UI & Management: Provides a modern web interface with real-time dashboards, asset overview tables, manual image choice pickers, collection poster designers, logs viewer, and queue runners.
- Notification & Arr Integrations: Webhooks for Apprise, Discord, Uptime Kuma, and callbacks for Agregarr.
2. Technology Stack & Components
| Component | Technology | Primary Location | Key Responsibilities |
|---|---|---|---|
| Automation Core | PowerShell (pwsh 7+) | Posterizarr.ps1, modules/ |
Scrapes APIs, prepares images, executes ImageMagick commands, uploads to media servers, manages backups. |
| Web UI Backend | Python 3.13 + FastAPI + Uvicorn | webui/backend/main.py |
Serves REST API and WebSockets, manages SQLite DBs, coordinates background runs, handles proxies. |
| Web UI Frontend | React 18 + Vite + Tailwind CSS | webui/frontend/ |
Responsive dark-themed UI, Asset Overview, Live Collection Editor, Settings Editor, Logs, Queue Manager. |
| Image Processing | ImageMagick 7 (magick) + Pillow |
Alpine / System packages | Compositing overlays, badge positioning, typography rendering, color extraction, textless detection. |
| Databases | SQLite3 | database/*.db |
imagechoices.db, config.db, queue.db, server_libraries.db, media_export.db. |
| Containerization | Docker (Alpine 3.24) | Dockerfile, Start.ps1, start.sh |
Orchestrates multi-process runtime (uvicorn backend + pwsh Start.ps1 scheduler/worker). |
3. Directory Structure Map
PosterizarrUI_dev/
├── Posterizarr.ps1 # Main PowerShell CLI entrypoint for standalone runs
├── Start.ps1 # Container entrypoint script (manages schedule, integrity check)
├── Dockerfile # Multi-stage Docker build (Node frontend -> Python Alpine runtime)
├── config.example.json # Master template for all configuration sections and default values
├── Overlayfiles/ # Stock overlay PNGs, fonts (.ttf, .otf), and graphic assets
│
├── modules/ # Core PowerShell automation modules
│ ├── core/
│ │ ├── Variables.ps1 # Global variables, branch detection, config loader, paths
│ │ ├── PrerequisitesCheck.ps1 # Directory validation, tool check (ImageMagick), font installs
│ │ └── Database.ps1 # SQLite helper wrappers for PowerShell
│ └── functions/
│ ├── ApiHandlers.ps1 # TMDB, TVDB, Fanart, Plex, Jellyfin, Emby API requests
│ ├── CoreGeneration.ps1 # ImageMagick CLI command construction & composition logic
│ ├── System.ps1 # Path security, CheckJson config validator, process execution
│ ├── Notifications.ps1 # Discord, Apprise, Uptime Kuma, Agregarr webhook payloads
│ └── BackupRestore.ps1 # Image backup and rollback system
│
├── webui/
│ ├── backend/ # FastAPI backend
│ │ ├── main.py # Main API routes, WebSocket listeners, image proxying
│ │ ├── scheduler.py # Cron / interval scheduling engine for Posterizarr runs
│ │ ├── queue_manager.py # Job queue for asset processing requests
│ │ ├── config_database.py # SQLite CRUD for WebUI configuration
│ │ └── overlay_generator.py # Python/Pillow overlay generator for live previews
│ └── frontend/ # Vite + React single-page application
│ ├── src/
│ │ ├── components/ # AssetOverview, ConfigEditor, CollectionLiveEditor, Dashboard, etc.
│ │ ├── i18n/ # Translation dictionaries (en, de, fr, es, etc.)
│ │ └── App.jsx # Root routing and theme provider
│ └── package.json
│
└── docs/ # Markdown documentation for users and developers
4. Runtime & Container Lifecycle
Docker Architecture:
- In Docker (
IS_DOCKER = True), paths are standardized: /config($env:APP_DATA): Containsconfig.json, logs, cache, and SQLite databases./app($env:APP_ROOT): Read-only application files and modules./assets: Target directory where generated artwork is written./manualassets: Custom images placed by users to override scrapers./assetsbackup: Original unmodified artwork before processing.start.shstartsuvicornin the background (port 8000), then startsStart.ps1viacatatonit.- Integrity Validation:
Start.ps1runsCheckJsonto syncconfig.jsonagainstconfig.example.jsonbefore triggering scheduled runs.
Local Development:
- Backend:
uvicorn main:app --host 127.0.0.1 --port 8000fromwebui/backend/(uses.venv). - Frontend:
npm run devfromwebui/frontend/(proxies/apito port 8000). - PowerShell:
pwsh ./Posterizarr.ps1 -devfrom the workspace root.
5. Configuration Architecture (config.json)
Posterizarr uses a categorized JSON config (config.json). The authoritative schema is defined in config.example.json.
Primary Sections:
WebUI: Basic auth credentials (basicAuthEnabled,basicAuthUsername,basicAuthPassword).ApiPart: Metadata provider API keys, resolutions, language sequences, and provider priority rules.PlexPart/JellyfinPart/EmbyPart: Server URLs, tokens, library names, and per-server toggles.PosterOverlayPart/ShowPosterOverlayPart/SeasonPosterOverlayPart/BackgroundOverlayPart/TitleCardOverlayPart: Overlay positioning, dimensions, font sizes, colors, and badge preferences.Notification: Discord, Apprise, Uptime Kuma, and Agregarr trigger settings.
Provider Priority Strategy (ProviderPriorityMode):
Controls how Posterizarr selects artwork across TMDB, TVDB, Fanart, and local media servers:
- Simple: Starts with FavProvider (e.g. tvdb or tmdb), followed by standard fallback order.
- Global: Strictly adheres to the custom array in ApiPart.ProviderOrder (e.g. ["TMDB", "TVDB", "Fanart", "Plex"]).
- PerMediaType: Uses ApiPart.MovieProviderOrder for Movies, and ApiPart.ShowProviderOrder for TV Shows/Seasons.
- LibraryLanguageOverrides: Any library can override priority independently:
"LibraryLanguageOverrides": {
"Anime": {
"EnableProviderOrderOverride": true,
"ProviderOrder": ["TVDB", "TMDB", "Fanart", "Plex"],
"ApplyToPoster": true,
"ApplyToSeason": true,
"ApplyToBackground": true,
"ApplyToLogo": true
}
}
6. Critical Conventions & Gotchas for LLMs
- Schema Integrity (
CheckJson): CheckJsoncomparesconfig.jsontoconfig.example.json(downloaded from GitHub or read locally).- If you introduce new configuration keys, you MUST declare them in
config.example.json, otherwiseCheckJsonwill treat them as obsolete and remove them! -
Ensure branch detection (
$env:APP_VERSION -match 'dev') usesdevso development builds download from thedevbranch template. -
Cross-Provider URL Linking (
FavProviderLink): - In
AssetOverview.jsx,FavProviderLinkis intended to provide a direct link to the preferred provider so users can fix missing metadata on the upstream provider. -
If an asset used a fallback provider,
PrimaryProviderstill reflects the preferred provider, andasset.FavProviderLinkshould always be resolved if possible. -
ImageMagick Command Construction:
- In
CoreGeneration.ps1, commands are built into an array of string arguments passed tomagick. -
Take extreme care with Windows vs Linux quotes and path separators (
/vs\). Always use standard PowerShell array syntax without breaking string interpolation. -
WebUI Data Normalization:
-
The backend supports both grouped configuration (e.g.,
config["ApiPart"]["FavProvider"]) and flat configuration forms (config["FavProvider"]). When querying via/api/config, always use the helper functions or verify structure presence. -
No Placeholders:
- Do not commit mock or empty dummy images. Assets should be processed with the actual ImageMagick or Pillow pipelines.