This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Sootio is a Stremio addon that aggregates streaming links from multiple sources:
- 7 Debrid providers: Real-Debrid, All-Debrid, TorBox, Premiumize, OffCloud, Debrid-Link, Debrider.app
- 14+ torrent scrapers: Jackett, Zilean, 1337x, BTDigg, MagnetDL, Torrentio, Comet, etc.
- HTTP streaming providers: 4KHDHub, UHDMovies, MKVDrama, NetflixMirror, etc.
- Usenet support: Newznab indexers + SABnzbd with progressive streaming
Built with Node.js 20, ESM modules, Express, and the Stremio Addon SDK.
# Install dependencies (pnpm required)
pnpm install
# Production with multi-worker clustering
npm start # or: npm run start
# Development with auto-reload
npm run dev
# Single worker mode (debugging)
npm run standalone # or: npm run standalone:dev for debug logs
# Run tests
npm test
# Run single test file
node --max-old-space-size=2048 --expose-gc node_modules/.bin/jest tests/mkvdrama.test.js
# Docker
docker-compose up -d --build
docker-compose logs -fserver.js- Express server, route handlers, Stremio SDK integration (~1400 lines)cluster.js- Multi-worker process management with crash loop protectionaddon.js- Stremio addon builder, catalog and stream handlers
- Request →
addon.jsdefineStreamHandler - Orchestration →
lib/stream-provider.jscoordinates all sources in parallel - Scraping →
lib/scrapers/fetches torrent metadata from enabled sources - Cache Check →
lib/common/debrid-cache-processor.jschecks debrid availability - Formatting →
lib/stream-provider/formatters/formats streams for Stremio
lib/
├── scrapers/ # Torrent scrapers by category
│ ├── public-trackers/ # 1337x, btdig, magnetdl, etc.
│ ├── torznab/ # Jackett, Zilean, Bitmagnet
│ ├── stremio-addons/ # Torrentio, Comet, StremThru bridges
│ └── specialized/ # Wolfmax4K, BluDV, Snowfl
├── http-streams/ # HTTP streaming providers
│ ├── providers/ # 4khdhub, mkvdrama, netflixmirror, etc.
│ ├── resolvers/ # Link resolution (hubcloud, pixeldrain, etc.)
│ └── utils/ # HTTP helpers, parsing, validation
├── util/ # Shared utilities
│ ├── cache-store.js # SQLite cache backend selector
│ ├── postgres-cache.js # Postgres cache for multi-instance
│ ├── rd-rate-limit.js # Real-Debrid rate limiter
│ ├── ad-rate-limit.js # All-Debrid rate limiter
│ ├── proxy-manager.js # SOCKS5/HTTP proxy handling
│ └── cinemeta.js # IMDB metadata fetching
├── stream-provider/ # Stream orchestration modules
│ ├── caching/ # Background refresh, deduplication
│ ├── formatters/ # Stream name/description formatting
│ └── utils/ # Filtering, sorting utilities
└── [provider].js # Debrid provider implementations
Each debrid provider (lib/real-debrid.js, lib/all-debrid.js, etc.) implements:
checkCachedTorrents(apiKey, magnets)- Check cache availabilitygetDownloadUrl(apiKey, magnet, fileIdx)- Get streaming URL- Personal cloud/downloads listing
- Create file in
lib/scrapers/[category]/following existing patterns - Export
scrapeTorrents(imdbId, type, title, year, season, episode)function - Register in
lib/scrapers/index.js - Add env vars in
.env.examplewith[NAME]_ENABLED,[NAME]_URL, etc.
- Create directory in
lib/http-streams/providers/[name]/ - Implement
search.jsandstreams.js - Register in
lib/http-streams.jsexports - Add to
lib/stream-provider.jsHTTP streaming section
All config via .env file. Key patterns:
[SCRAPER]_ENABLED=true/false- Enable/disable scrapers[SCRAPER]_URL- Base URL for scraper[SCRAPER]_LIMIT- Max results per searchRD_*,AD_*- Rate limits for debrid providersDEBRID_HTTP_PROXY- SOCKS5/HTTP proxy URLSQLITE_CACHE_ENABLED=true- Enable persistent cacheCACHE_BACKEND=sqlite|postgres- Cache backend selection
Tests are in tests/ using Jest. Most tests are integration tests that hit external APIs.
# Run all tests
npm test
# Run specific test
npm test -- tests/mkvdrama.test.js
# Run with verbose output
npm test -- --verboseDebrid APIs have strict rate limits. Use the rate limiters in lib/util/rd-rate-limit.js and lib/util/ad-rate-limit.js.
Proxy configuration flows through lib/util/proxy-manager.js. Per-service proxies can be configured via DEBRID_PER_SERVICE_PROXIES.
- In-memory - NodeCache for hot data (5000 entries)
- SQLite - Persistent cache (
data/directory) - Postgres - Optional shared cache for multi-instance deployments
This project uses ES modules ("type": "module" in package.json). Use import/export syntax, not require().