# Distributed Stremio Media Cluster Privé gedistribueerd mediaplatform voor **Stremio**: één Master, onbeperkt Media Nodes, video rechtstreeks van node naar player. ## Architectuur ``` Stremio ──HTTPS──► Master (catalog / meta / stream) ▲ │ WSS control Media Nodes │ Stremio ◄──HTTPS video──┘ (via Nginx Proxy Manager) ``` Harde eisen: - geen VPN / WireGuard / SMB / NFS tussen locaties - geen Docker op nodes - geen transcoding in V1 - geen raw filesystem paths publiek - server-side playback sessions (geen simpele 1-uur signed URLs) ## Stack | Component | Techniek | |-----------|----------| | Master API | TypeScript, Fastify, Prisma, PostgreSQL, Redis | | Admin UI | Next.js | | Media Node | Go binary + SQLite + systemd | | Proxy | Nginx Proxy Manager (GUI only) | ## Repository ``` apps/master-api/ Master + Stremio addon apps/admin-ui/ Admin dashboard node/media-node/ Go media node packages/ Gedeelde types + protocol deploy/docker/ Docker Compose Master deploy/node/ Installer + systemd docs/ Deployment + NPM setup ``` ## Snel starten (dev) ```bash npx pnpm install # Postgres + Redis cd deploy/docker docker compose up -d postgres redis # Master cd ../../apps/master-api cp .env.example .env # DATABASE_URL=postgresql://media:media_secret@localhost:5432/media_cluster npx prisma migrate deploy npx pnpm db:seed npx pnpm dev # Admin UI cd ../admin-ui npx pnpm dev ``` - API: http://localhost:3000 - UI: http://localhost:3001 - Login: `admin@localhost` / `changeme123` ## Media Node Op Linux (productie): ```bash cd node/media-node GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -o media-node ./cmd/media-node sudo ./media-node install ``` CLI: ``` media-node install|register|run|scan|diagnostics|config|start|stop|restart|status|version ``` ## Productie Zie: - [docs/deployment.md](docs/deployment.md) - [docs/dokploy.md](docs/dokploy.md) — **Master op Dokploy (aanbevolen)** - [docs/npm-setup.md](docs/npm-setup.md) ```bash cd deploy/docker cp ../master/.env.example ../master/.env docker compose up -d --build ``` Of in Dokploy: Compose-app met pad `deploy/docker/docker-compose.dokploy.yml`. ## Stremio installeren 1. Admin UI → **Instellingen** → addon token 2. URL in Stremio: `https://master.example.com/stremio//manifest.json` ## V1 features - Node enrollment + unieke credentials - WebSocket control channel + heartbeat + reconnect - Movies/Series scanner + library sync - Filename parsing + TMDB matching (optioneel) - Stremio catalogs / meta / streams - Playback sessions met idle + absolute expiry - HTTP Range streaming (direct play) - Offline node detectie + duplicate media - Admin: dashboard, nodes, library, streams, matching ignore/refresh - Rate limits, security headers, redacted token logs - Backup script + release build script ## Tests ```bash cd apps/master-api && npx pnpm test cd node/media-node && go test ./... ```