Follow-up #1 to the service-registry change. Jellyfin/Jellyseerr now resolve from the service registry, so the machine-level app fields are dead config. - dependencies.py: drop dead _jellyseerr_client_for; simplify _resolve_machine to SSH-only. - settings_store.py + routers/settings.py: remove jellyfin_*/jellyseerr_* from machine default config, get_machine_config, normalization, row mappers, and MachineInput. - frontend types + Settings.tsx: drop the fields and the Jellyfin/Jellyseerr form sections + service options. - Update frontend test fixtures. Existing DB rows may still carry these keys in config_json; they are inert and drop on the next machine save. Verification: backend ruff clean, pytest 222; frontend lint 0 errors, build success, 70 tests.
Manage Backend API
FastAPI backend serving the REST API for Jellyfin media browsing, SSH file inspection, server monitoring, and JWT-protected access for Manage.
Project structure
backend/
├── pyproject.toml
├── README.md
├── src/
│ └── media_library_viewer_api/
│ ├── __init__.py
│ ├── main.py # FastAPI app entrypoint
│ ├── config.py # pydantic-settings config
│ ├── dependencies.py # Dependency injection
│ ├── path_utils.py # Jellyfin→SSH path resolution
│ ├── jobs.py # Job templates
│ ├── utils.py # Formatting helpers
│ ├── routers/
│ │ ├── dashboard.py
│ │ ├── monitoring.py
│ │ ├── media.py
│ │ ├── users.py
│ │ ├── settings.py
│ │ ├── files.py
│ │ └── jobs.py
│ ├── clients/
│ │ ├── jellyfin.py
│ │ ├── jellyseerr.py
│ │ ├── local.py
│ │ ├── resources.py
│ │ └── ssh.py
│ ├── domain/
│ │ └── media.py
│ └── services/
│ ├── media_index.py
│ └── settings_store.py
└── tests/
Setup
cd backend
python -m venv .venv
source .venv/bin/activate
pip install -e '.[dev]'
Configuration
Set environment variables directly in your shell or a wrapper script before running the app or Compose. The Docker Compose files use interpolation and do not require an env_file entry.
For local .env development, you can still create one if you prefer, but it is optional.
# Optional backend logging level
LOG_LEVEL=INFO
# Optional SMTP settings for the Users -> message popup
SMTP_HOST=smtp.example.com
SMTP_PORT=587
SMTP_USERNAME=your-smtp-username
SMTP_PASSWORD=your-smtp-password
SMTP_FROM_ADDRESS=no-reply@example.com
SMTP_FROM_NAME=Manage
SMTP_USE_TLS=true
SMTP_USE_SSL=false
SMTP_TIMEOUT=30
# Jellyfin, Jellyseerr, and SSH targets are now configured per machine in the app's Settings tab.
# The backend seeds a local machine automatically, so no global Jellyfin or SSH env vars are required.
# Versioning
# The backend tries to auto-detect its version from installed package metadata.
# If needed, you can override the displayed version/build markers with APP_VERSION and APP_BUILD_INFO.
APP_VERSION=0.1.0
APP_BUILD_INFO=dev
# Authentik / OIDC
AUTH_ENABLED=true
OIDC_ISSUER_URL=https://authentik.example/application/o/media-library-viewer/
OIDC_AUDIENCE=media-library-viewer
OIDC_JWKS_URL=
OIDC_CLOCK_SKEW_SECONDS=30
Running
cd backend
uvicorn media_library_viewer_api.main:app --reload --port 8000
Or with PYTHONPATH if not installed:
PYTHONPATH=src uvicorn media_library_viewer_api.main:app --reload --port 8000
API docs available at: http://localhost:8000/docs
Docker
The repository root includes a production docker-compose.yml and a development docker-compose.dev.yml.
The backend media index is stored in the backend_cache Docker volume so it survives container restarts and image rebuilds.
The production compose file expects required environment variables to be supplied via interpolation (shell exports or inline VAR=value docker compose ...).
Configuration workflow examples
- Export your runtime variables before launching Compose:
export BACKEND_APP_HOST=manage.example.com
export FRONTEND_APP_HOST=manage.example.com
export CERT_RESOLVER=letsencrypt
export VITE_OIDC_ISSUER=https://authentik.example/application/o/manage/
export VITE_OIDC_CLIENT_ID=manage
export VITE_OIDC_REDIRECT_URI=https://manage.example.com/
export VITE_OIDC_POST_LOGOUT_REDIRECT_URI=https://manage.example.com/
docker compose up --build
-
After the API is running, open the app, go to Settings, and add machine entries:
- Local: monitors the API host itself without SSH.
- SSH: monitors another machine using a host, username, and a private key pasted directly into the machine settings, with an optional passphrase.
- The machine editor groups Connection, Monitoring / Files, Jellyfin, Jellyseerr, and Notes under separate headings so each service area is easier to scan.
- Saving a monitoring machine now validates the banner/auth flow, records the first trusted host key into the backend-managed
known_hostsfile, and starts the collector so charts populate without a separate manual step. - If the host cannot be reached or authenticated, the save flow surfaces the SSH error directly in the dialog.
- Use Validate SSH + trust host in the machine editor before saving if you want to test the banner/auth flow explicitly.
- The first successful SSH connection uses trust-on-first-use: the backend records that machine's host key into its managed
known_hostsfile automatically, then continues verifying it strictly on later connects.
-
Open Monitoring to see one section per configured machine. Each section uses its own collector state, disk path, metrics queries, and recent action history, which are populated automatically by the backend poller.
For local development, docker compose -f docker-compose.dev.yml up --build does not require an SSH key unless you configure remote SSH machines in the Settings tab.
API Endpoints
GET /api/dashboard/counts— Movie/series/episode totalsGET /api/dashboard/libraries— Per-library breakdownGET /api/dashboard/now-playing— Active playback sessionsGET /api/monitoring/machines— Persistent monitoring machine definitionsGET /api/monitoring/status?machine_id=— Collector status for a machineGET /api/monitoring/metrics?machine_id=— Resource samples (last hour)GET /api/monitoring/disk?machine_id=— Disk spacePOST /api/monitoring/start|stop|restart?machine_id=— Collector controlsGET /api/monitoring/diagnostics?machine_id=— Collector debug infoGET /api/monitoring/poller— Backend poller status and configurationGET /api/monitoring/machines/{machine_id}/actions— Recent machine action historyGET /api/dashboard/monitoring— Dashboard-wide per-machine monitoring summary table with 10-minute averages and min/max subtextGET /api/settings/machines— Manage machine definitionsGET /api/media/status— Index statusPOST /api/media/build— Rebuild indexGET /api/media/query— Query with filters/sort/paginationGET /api/files/list?path=— Directory listingGET /api/files/ffprobe?path=— ffprobe JSONGET /api/files/stat?path=— stat outputGET /api/files/resolve-path?path=— Path resolutionGET /api/jobs/templates— Available jobsPOST /api/jobs/run— Execute a jobGET /api/users— Jellyfin users with optional Jellyseerr enrichmentGET /api/version— Backend version/build metadata for the UI