$ show MunifTanjim/stremthru
StremThru is a media server backend designed as a companion for Stremio, providing unified access to torrents, Usenet, and various debrid services (Real-Debrid, TorBox, AllDebrid, etc.) through Stremio addons. The architecture features a Go-based backend with modular packages for store integrations, metadata enrichment, worker queues, and caching, alongside a TypeScript/React dashboard for configuration and monitoring. Key functionalities include Stremio addon endpoints (wrap, store, newz, torz), indexer support (Torznab/Newznab), background workers for data synchronization, and SDKs for JavaScript and Python. Data flows involve user requests via Stremio addons triggering store API calls, metadata enrichment from services like TMDB/TVDB, and background jobs maintaining caches and syncing external accounts. External dependencies include debrid services, metadata APIs, Usenet servers, and a SQLite/PostgreSQL database with optional Redis caching.
The LLM identified 5 files worth highlighting for reuse:
A generic caching interface with multiple implementations (LRU, disk-backed via otter, Redis, and singleflight for deduplication). Used throughout for API responses, ID maps, and transient data, demonstrating a clean, reusable abstraction with minimal coupling.
Provides a simple HTTP client wrapper with context propagation, retry logic, and standardized error handling. Low dependency count and focused design make it easily extractable for use in other Go projects requiring robust HTTP interactions.
A generic job queue system with in-memory and persistent (boltdb) backends, supporting delayed jobs and deduplication. Used for background workers (e.g., metadata synchronization), showing a well-encapsulated pattern for asynchronous task processing.
Implements database-level advisory locks for PostgreSQL with a SQLite fallback, providing a simple API for distributed locking. Small, focused, and dependency-light, solving a common concurrency problem with high reusability.
Utilities for processing and diffing datasets in CSV, TSV, and JSON formats. Includes reading, writing, and difference computation, demonstrating reusable data engineering patterns independent of the application's core logic.