stremio-server-go

module
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 26, 2026 License: MIT

README

stremio-server-go

A lightweight, IPv6-capable, open-source drop-in replacement for Stremio's closed-source streaming server (server.js), built on anacrolix/torrent. It serves the exact enginefs HTTP API that stremio-web expects, so it drops straight in.

Not affiliated with or endorsed by Stremio.

Features

  • Dual-stack torrent engine - IPv4 + IPv6, TCP + uTP, BEP32 DHT, PEX, WebTorrent, webseeds; curated public trackers with RTT ranking + 24h refresh.
  • Full enginefs API - create/stats.json/remove, Range/206 streaming with DLNA headers, network-info, device-info, settings, opensubHash, subtitlesTracks, /probe, /tracks, /list, /:ih/peers.
  • HLSv2 transcoding - on-demand ffmpeg with multi-platform hardware accel (VAAPI / NVENC / QSV / VideoToolbox / V4L2M2M, verified at startup, libx264 fallback), multi-audio + embedded-subtitle renditions, and seek-aware segments.
  • Subtitles - SRT / WebVTT / ASS-SSA to WebVTT, OpenSubtitles hashing.
  • Reverse proxy (/proxy), DLNA casting (/casting, SSDP discovery + UPnP AVTransport control), local-files addon (/local-addon, IMDB-resolved), YouTube (/yt, via yt-dlp), and /get-https (Stremio cert provisioning).
  • Disk-bounded cache - LRU eviction honouring the cacheSize setting.
  • Self-signed HTTPS on :12470 for HTTPS web UIs (e.g. WebKitGTK shells).

Install

Prebuilt binaries for Linux, macOS, Windows, and Android (arm64) are attached to each release.

From source (Go 1.24+; CGO is not required):

go install github.com/M0Rf30/stremio-server-go/cmd/stremio-server@latest
# or, in a checkout:
make build          # -> ./stremio-server
make build-all      # cross-compile every target into dist/
Container / HuggingFace

A multi-stage Dockerfile (ffmpeg + yt-dlp bundled, non-root, /data volume) builds an image runnable under Podman/Docker or as a HuggingFace Space. See docs/CONTAINER.md.

Run

./stremio-server            # http://127.0.0.1:11470  (https on :12470)
./stremio-server version    # print build version

Then point any Stremio client's streaming server URL at http://127.0.0.1:11470.

Environment
Variable Default Purpose
HTTP_PORT 11470 enginefs HTTP API port
HTTPS_PORT 12470 self-signed / provisioned HTTPS port (0 disables)
BT_LISTEN_PORT 0 BitTorrent peer port (0 = OS-assigned)
APP_PATH ~/.stremio-server data/cache root
WEB_UI_LOCATION https://web.stremio.com/ redirect target for GET /
LOCAL_FILES_DIR (unset) directory scanned by the local-files addon
STREMIO_HWACCEL (auto) 0 forces software transcode; or pin vaapi/nvenc/…
STREMIO_HTTP_LOG (off) 1 logs each request (path only)
STREMIO_PROXY_PASSWORD (unset) api_password required on /proxy/* requests
STREMIO_PROXY_SECRET (auto) signing key for signed proxy URLs (auto-generated under APP_PATH)
STREMIO_PROXY_IP_ACL (unset) comma-separated CIDR allowlist for proxy clients
STREMIO_PROXY_PREBUFFER 3 upcoming segments to prefetch (0 = off)
STREMIO_PROXY_SEG_CACHE_TTL 300 proxy segment cache TTL, seconds (0 = off)
STREMIO_PROXY_PUBLIC_URL (derive) external base URL written into rewritten manifests

The stream proxy (HLS/DASH manifest rewriting, on-the-fly decryption, signed URLs) is documented in docs/PROXY.md.

Platforms

CGO_ENABLED=0 everywhere, so all targets are pure-Go cross-compiles: linux/{amd64,arm64,arm}, darwin/{amd64,arm64}, windows/{amd64,arm64}, android/arm64. Android additionally builds with -ldflags=-checklinkname=0 (for github.com/wlynxg/anet on Go 1.23+); it also runs as a plain linux/arm64 binary under Termux.

Layout

Path Responsibility
cmd/stremio-server entrypoint, wiring, TLS, version
internal/types shared contract (structs + interfaces)
internal/engine anacrolix client, readers, stats, trackers, cache eviction
internal/api enginefs routes, streaming, proxy, casting, local-addon, youtube
internal/settings settings store (server-settings.json)
internal/media ffprobe, HLS transcode, subtitles, opensub hash
docs/swagger.yaml OpenAPI/Swagger spec, generated from code (make swagger)
scripts/smoke.sh end-to-end API smoke test

Security

This is a localhost service with no authentication - bind it to loopback and do not expose :11470 to untrusted networks. By design it shells out to ffmpeg/yt-dlp and acts as an open reverse proxy (/proxy) for the local web UI; treat anything that can reach the port as fully trusted.

License

MIT - Copyright (c) 2026 Gianluca Boiano.

Directories

Path Synopsis
cmd
stremio-server command
Command stremio-server is a lightweight, IPv6-capable drop-in replacement for Stremio's closed-source streaming server (server.js), built on anacrolix/torrent.
Command stremio-server is a lightweight, IPv6-capable drop-in replacement for Stremio's closed-source streaming server (server.js), built on anacrolix/torrent.
internal
api
Package api implements the enginefs-compatible HTTP surface that stremio-web expects from a Stremio streaming server.
Package api implements the enginefs-compatible HTTP surface that stremio-web expects from a Stremio streaming server.
engine
Package engine wraps anacrolix/torrent to provide the EngineManager and Engine interfaces declared in internal/types.
Package engine wraps anacrolix/torrent to provide the EngineManager and Engine interfaces declared in internal/types.
media
Package media implements types.MediaProber, backing the ffprobe/ffmpeg helper routes.
Package media implements types.MediaProber, backing the ffprobe/ffmpeg helper routes.
settings
Package settings implements types.SettingsStore: it holds the user-facing server settings, persists them to <appPath>/server-settings.json, and exposes the GUI schema expected by stremio-web's settings panel.
Package settings implements types.SettingsStore: it holds the user-facing server settings, persists them to <appPath>/server-settings.json, and exposes the GUI schema expected by stremio-web's settings panel.
streamproxy
Package streamproxy implements an HTTP stream proxy with HLS/DASH manifest rewriting, optional segment decryption, signed URLs, and caching.
Package streamproxy implements an HTTP stream proxy with HLS/DASH manifest rewriting, optional segment decryption, signed URLs, and caching.
types
Package types holds the shared contract between the engine, api, settings and media packages.
Package types holds the shared contract between the engine, api, settings and media packages.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL