Developer Guide
This section is for those who want to contribute to Media Manager or understand its internals.
Source Code directory structure
media_manager/: Backend FastAPI applicationweb/: Frontend SvelteKit applicationWriterside/: Documentationmetadata_relay/: Metadata relay service, also FastAPI
Special Dev Configuration
Environment Variables
MediaManager uses various environment variables for configuration. In the Docker development setup (docker-compose.dev.yaml), most of these are automatically configured for you.
Backend Variables
BASE_PATHBase path for the app (for subdirectory deployments).PUBLIC_VERSIONVersion string displayed in/api/v1/health.FRONTEND_FILES_DIRDirectory for built frontend files (e.g./app/web/buildin Docker).MEDIAMANAGER_MISC__DEVELOPMENTWhen set toTRUE, enables FastAPI hot-reloading in Docker.
Frontend Variables
PUBLIC_API_URLAPI URL for backend communication (auto-configured via Vite proxy in Docker).PUBLIC_VERSIONVersion string displayed in the frontend UI.BASE_PATHBase path for frontend routing (matches backendBASE_PATH).
Docker Development Variables
DISABLE_FRONTEND_MOUNTWhenTRUE, disables mounting built frontend files (allows separate frontend container).
Configuration Files
Backend:
res/config/config.toml(created fromconfig.dev.toml)Frontend:
web/.env(created from.env.example)
Contributing
Consider opening an issue to discuss changes before starting work
Setting up the Development Environment
I use IntellijIdea with the Pycharm and Webstorm plugins to develop this, but this guide should also work with VSCode. Normally I'd recommend Intellij, but unfortunately only Intellij Ultimate has support for FastAPI and some other features.
Recommended VSCode Plugins
Python
Svelte for VSCode
Recommended Intellij/Pycharm Plugins
Python
Svelte
Pydantic
Ruff
VirtualKit
Writerside (for writing documentation)
Recommended Development Workflow
The recommended way to develop MediaManager is using the fully Dockerized setup with docker-compose.dev.yaml. This ensures you're working in the same environment as production and makes it easy for new contributors to get started without installing Python, Node.js, or other dependencies locally.
The development environment includes:
Backend (FastAPI) with automatic hot-reloading for Python code changes
Frontend (SvelteKit/Vite) with Hot Module Replacement (HMR) for instant updates
Database (PostgreSQL) pre-configured and ready to use
What supports hot reloading and what does not
Python code changes (.py files), Frontend code changes (.svelte, .ts, .css) and configuration changes (config.toml) reload automatically.
Changing the backend dependencies (pyproject.toml) requires rebuilding:
docker compose -f docker-compose.dev.yaml build mediamanagerChanging the frontend dependencies (package.json) requires restarting the frontend container:
docker compose -f docker-compose.dev.yaml restart frontendDatabase migrations: Automatically run on backend container startup
This approach eliminates the need for container restarts during normal development and provides the best developer experience with instant feedback for code changes.
How the Frontend Connects to the Backend
In the Docker development setup, the frontend and backend communicate through Vite's proxy configuration:
Frontend runs on:
http://localhost:5173(exposed from Docker)Backend runs on:
http://mediamanager:8000(Docker internal network)Vite proxy: Automatically forwards all
/api/*requests from frontend to backend
This means when your browser makes a request to http://localhost:5173/api/v1/tv/shows, Vite automatically proxies it to http://mediamanager:8000/api/v1/tv/shows. The PUBLIC_API_URL environment variable is set to use this proxy, so you don't need to configure anything manually.
Setting up the full development environment with Docker (Recommended)
This is the easiest and recommended way to get started. Everything runs in Docker with hot-reloading enabled.
Access the application
Frontend (with HMR): http://localhost:5173
Backend API: http://localhost:8000
Database: localhost:5432
The default user email is admin@example.com and password is admin, these are printed out in the logs accessible with make logs.
Now you can edit code and see changes instantly:
Edit Python files → Backend auto-reloads
Edit Svelte/TypeScript files → Frontend HMR updates in browser
Edit config.toml → Changes apply immediately
Setting up the backend development environment (Local)
Clone & prerequisites
Clone the repository
cd into repo root
Install
uv: https://docs.astral.sh/uv/getting-started/installation/Verify installation:
Install Python with uv
Create virtual environment
Install dependencies
Run database migrations
Run the backend (development mode)
Formatting & linting
Format code:
Lint code:
Setting up the frontend development environment (Local, Optional)
Using the Docker setup above is recommended. This section is for those who prefer to run the frontend locally outside of Docker.
Troubleshooting
Common Docker Development Issues
Tech Stack
Backend
Python
FastAPI
SQLAlchemy
Pydantic and Pydantic-Settings
Alembic
Frontend
TypeScript
SvelteKit
Tailwind CSS
shadcn-svelte
openapi-ts
openapi-fetch
CI/CD
GitHub Actions