Open Source

Snagbox

What it is

Snagbox is an open-source, self-hostable media downloader API built with NestJS. Queue a YouTube, TikTok, Instagram or X link, watch progress over server-sent events and download the file from a signed link.

I built Snagbox, an open-source, self-hostable REST API that turns a public link from YouTube, TikTok, Instagram, X and more into a clean file. You queue a job, watch progress over server-sent events and download the result from a signed link.

Result

Snagbox v2.0.0 is MIT-licensed on GitHub with a live playground. Anyone can self-host it and plug media downloads into their own apps and automation pipelines.

The problem

Most downloaders are ad-filled websites or fragile scripts. I wanted a real API that developers can run on their own server, with auth, queues, limits and storage handled properly instead of a single shell command.

What it does

  • Video or audio output with quality selection, GIF, H.264, subtitles, thumbnails and time clips
  • Single, batch and playlist downloads through a job queue
  • Live progress over server-sent events (SSE), signed expiring file links and optional HMAC-signed webhooks when a job finishes
  • API keys with rate limits and duration caps, an SSRF guard, and optional Better Auth
  • Local disk or any S3-compatible bucket (S3, R2) for storage
  • Prometheus metrics, structured logs, health checks, OpenAPI docs and a built-in playground

How it's built

  • A NestJS 11 API in TypeScript on yt-dlp and ffmpeg, with platform plugins and an optional generic mode
  • Workers pull jobs from Redis, or from memory when Redis isn't configured, with PostgreSQL for data
  • A one-command Docker Compose setup, a published image on GHCR and a Railway deploy template, running on any host with Node 22 and Postgres

Stack

  • NestJS
  • TypeScript
  • yt-dlp
  • ffmpeg
  • PostgreSQL
  • Redis
  • Docker
  • REST API
  • Server-Sent Events
  • Self-Hosted
  • Open Source

Gallery