I wanted to build something that combined my interest in distributed systems with a practical use case: streaming movies, anime, and shows directly from torrents. The goal was to create an efficient, fast web app (and eventually a desktop app) that could handle torrent downloads seamlessly in the background while providing a smooth viewing experience.
Torrentia is a high-performance BitTorrent client built in Go that lets you stream video content directly from torrent files. It handles peer discovery, piece downloading, and playback coordination all in one place. You can start watching almost immediately as pieces download in the background.
I built Torrentia using Go with concurrent goroutines to maximize throughput across multiple peer connections. The anacrolix/torrent library handles the core BitTorrent protocol implementation. I implemented gRPC messaging for communication between the backend and frontend, integrated DHT (distributed hash table) for efficient peer discovery without relying on trackers, and designed a pluggable storage layer with asynchronous disk I/O. Checksum validation ensures data integrity as pieces arrive.
The biggest challenges were managing concurrent goroutine lifecycles without memory leaks, optimizing piece selection strategy for streaming (prioritizing sequential pieces near the playback position), handling flaky peers that drop connections or send corrupted data, and balancing aggressive piece requests with fair bandwidth sharing across the swarm.
I achieved a 40% throughput improvement over my initial baseline implementation by tuning goroutine pools and connection management. The architecture is clean and modular, making it easy to swap storage backends or add new transport protocols. The streaming experience feels responsive, with minimal buffering once the initial pieces are downloaded.
I want to build out a proper web UI with search, library management, and playback controls. Desktop app support using Electron or Wails is also planned. Longer term, I'd like to experiment with more advanced piece selection algorithms, add support for magnet links with metadata exchange, and implement bandwidth throttling controls for users on limited connections.
