NestJS + Bull + Redis + Postgres service for background video downloads (Bilibili, YouTube, and generic sources), with worker-side merge/transcode and job history tracking.
- Exposes HTTP endpoints to enqueue download jobs and query progress.
- Uses Bull queues for async processing:
downloadsfor master jobs.download-partsfor segmented/byte-range part jobs.
- Runs API and worker in separate processes (same codebase, toggled by
WORKER=true). - Writes intermediate artifacts/manifests to
data/and final media files tovideo-result/.
- Docker + Docker Compose (recommended for local development).
pnpm(via Corepack) if you also run commands outside containers.
# from project root
corepack enable
docker compose up --build -dServices started by docker-compose.yml:
apionhttp://localhost:3000worker(2 replicas by default)postgresonlocalhost:5432redisonlocalhost:6379
-
Swagger UI:
http://localhost:3000/docshttp://localhost:3000/api
-
Core endpoints:
POST /downloadGET /download/status/:idPOST /download/:id/resumePOST /download/:id/cancelPOST /download/:id/merge-partial
Example request:
curl -X POST http://localhost:3000/download \
-H 'Content-Type: application/json' \
-d '{
"url": "https://www.bilibili.com/video/BV1xx411c7mD",
"platform": "auto",
"media": "both",
"engine": "auto"
}'- Container logs:
docker compose logs -f apidocker compose logs -f worker
- File logs (inside mounted workspace):
- API:
logs/api/app.*.log - Worker aggregate:
logs/worker/app.*.log - Worker instance:
logs/worker/<worker-label>/app.*.log
- API:
- Helper commands:
make apimake worker
config/runtime YAML config (config.default.yaml+ source overrides).data/manifests, part files, and job history (data/jobs/<jobId>.json).video-result/final output files by platform/title.docs/architecture and developer notes.test/manual/manual integration/debug scripts (excluded from Jest runs).