This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Mustarrd is an IPTV catchup DVR web app. It connects to Xtream Codes IPTV servers, browses past EPG programs, and downloads catchup/timeshift streams with smart filename templating, commercial skip (Comskip), and GPU/CPU re-encoding (FFmpeg).
Backend (FastAPI, port 4177):
cd backend
python -m venv venv && source venv/bin/activate
pip install -r requirements.txt
python main.pyFrontend (React + Vite, port 4178 in dev, proxies /api to 4177):
cd frontend
npm install
npm run devDocker (full stack):
docker-compose up -d
# backend: 4177, frontend: 4178No automated test suite exists. If adding tests: backend/tests/ or frontend/src/__tests__/.
- User picks a channel+EPG program → frontend calls
POST /api/downloads/ download_manager(service) picks up the queued record and fetches the Xtream catchup URL- FFmpeg downloads the TS stream;
post_processorhandles Comskip and/or transcoding - Finished file moves to the completed folder
- Real-time progress flows over WebSocket at
/api/downloads/ws
download_manager— concurrent download queue; resumes in-progress tasks on restartpost_processor— Comskip + FFmpeg re-encode/remux pipelineepg_ingest_manager— periodically refreshes EPG from Xtream for all accountsscheduled_manager— fires scheduled recordings as their time arrives
SQLite via async SQLAlchemy. Schema is created and migrated on every startup in backend/database.py using lightweight ALTER TABLE checks — no migration framework. app_settings table holds global config (padding defaults, transcode flags, etc.).
Key constraint: enabling Comskip forces transcode_enabled = true; enabling commercial removal forces remux_only = false.
Session-based auth implemented in backend/auth.py and backend/api/auth.py. Optional/progressive: first run requires no password; once an admin password is set via /auth/setup, protected endpoints require login. Frontend uses ProtectedRoute in App.jsx and checks /api/auth/status on load.
All settings use the CATCHUP_ env prefix (see backend/config.py). A .env file in backend/ is supported. Key vars:
CATCHUP_DATABASE_URL— defaults to SQLite in/app/config/(Docker) ordata/(local)CATCHUP_DEFAULT_DOWNLOAD_FOLDER/CATCHUP_DEFAULT_COMPLETED_FOLDERCATCHUP_MAX_CONCURRENT_DOWNLOADS(default: 2)CATCHUP_FFMPEG_PATH,CATCHUP_COMSKIP_PATH— override auto-detected tool pathsCATCHUP_TIMEZONE,CATCHUP_DEBUG
- Python: 4-space indentation; async throughout (FastAPI + SQLAlchemy AsyncIO)
- React: 2-space indentation; PascalCase components, camelCase hooks/helpers
- Mantine UI 7.x for all frontend components; TanStack React Query for data fetching
- No repo-wide formatter — match the style of the file you're editing
- Short imperative commit messages (e.g.,
Fix missing Path import) - PRs need: concise summary, steps to test, screenshots for UI changes