MCPSERV.CLUB
bittorrent-tracker

bittorrent-tracker

Self-Hosted

Node.js BitTorrent tracker and client for HTTP, UDP, and WebRTC

Active(75)
1.9kstars
0views
Updated Sep 6, 2025
bittorrent-tracker screenshot 1
1 / 3

Overview

Discover what makes bittorrent-tracker powerful

`bittorrent-tracker` is a full‑stack BitTorrent tracker written in Node.js that serves both as a lightweight HTTP/HTTPS and UDP tracker server, and as a client library for connecting to any compatible tracker. From a developer’s standpoint it implements the core BitTorrent Specification (BEP 12, BEP 15) and extends support to WebRTC‑based trackers used by WebTorrent. The package exposes a clean API that allows embedding tracker functionality into any Node or browser environment, making it ideal for projects that need to publish or consume torrent metadata without relying on third‑party tracker services.

Runtime

Core libraries

Data handling

Statistics

Overview

bittorrent-tracker is a full‑stack BitTorrent tracker written in Node.js that serves both as a lightweight HTTP/HTTPS and UDP tracker server, and as a client library for connecting to any compatible tracker. From a developer’s standpoint it implements the core BitTorrent Specification (BEP 12, BEP 15) and extends support to WebRTC‑based trackers used by WebTorrent. The package exposes a clean API that allows embedding tracker functionality into any Node or browser environment, making it ideal for projects that need to publish or consume torrent metadata without relying on third‑party tracker services.

Technical Stack

  • Runtime: Node.js (ES2015+), with optional browser support via WebRTC.
  • Core libraries: net, dgram for UDP, http/https for HTTP(S) trackers; optional wrtc for WebRTC peers.
  • Data handling: Bencode parsing/encoding for tracker requests and responses; built‑in support for IPv4/IPv6 addresses.
  • Statistics: In‑memory store with periodic persistence to JSON; exposes /stats (HTML) and /stats.json endpoints for monitoring.
  • Testing: A comprehensive offline test suite that covers tracker logic, edge cases, and protocol compliance.

Core Capabilities

  • Dual Protocol Support: Handles both HTTP(S) and UDP tracker requests, including the BEP 15 UDP handshake, announce, and scrape operations.
  • WebRTC Integration: Provides a WebTorrent‑specific client that negotiates peers over WebRTC, including custom rtcConfig and wrtc options for Node environments.
  • Custom Parameters: Developers can inject arbitrary query parameters via getAnnounceOpts, enabling metrics or authentication tokens to be forwarded transparently.
  • Proxy & Agent Configuration: proxyOpts allows routing tracker traffic through HTTP agents, SOCKS proxies, or custom network stacks.
  • Statistics API: Real‑time swarm metrics (peer count, downloads, uploads) are exposed via a simple REST endpoint for dashboards or alerting systems.

Deployment & Infrastructure

Running the tracker as a self‑hosted service is straightforward: it listens on configurable ports (default 8000 for HTTP, 6969 for UDP) and can be containerized with Docker or Kubernetes. Because it is pure Node.js, the tracker scales horizontally by spinning up multiple instances behind a load balancer; state is kept in memory, so any shared storage or clustering layer would require custom implementation. For production deployments, enabling TLS (via https module) and rate‑limiting middleware is recommended to mitigate abuse. The lightweight footprint (≈10 MB of dependencies) makes it suitable for edge nodes or cloud‑flare workers that support Node runtime.

Integration & Extensibility

The module exposes event emitters (announce, scrape, error) that allow developers to hook into tracker traffic. Plug‑in architecture is minimal but flexible: one can replace the default peer store with a Redis or MongoDB backend by overriding the internal peers map. Webhooks can be implemented by listening to events and publishing to external services (e.g., Slack, Prometheus). The server’s /stats endpoint can be consumed by Grafana dashboards, while the client API integrates seamlessly into existing torrent clients like WebTorrent Desktop or peer‑streaming libraries.

Developer Experience

Documentation is concise yet thorough, with clear type signatures and example usage. The code follows the StandardJS style guide, ensuring consistency across forks. Community support is active: the repository receives frequent updates, and the package is already a dependency of popular projects such as peerflix and playback. The test suite’s offline nature guarantees reliability, reducing integration friction. For developers looking to embed a tracker or build a custom torrent ecosystem, the library’s modular design and rich API surface make it an attractive choice over monolithic or proprietary tracker solutions.

Use Cases

  • Private Torrent Networks: Deploy a lightweight tracker to manage internal file distribution without external dependencies.
  • WebRTC‑Based Streaming: Integrate with WebTorrent Desktop or browser clients to expose peer lists for media streaming services.
  • Educational Projects: Teach BitTorrent protocol internals by modifying the tracker’s peer store or adding custom scrape metrics.
  • Hybrid Distribution: Combine DHT (bittorrent-dht) with a dedicated tracker to improve swarm stability for large media files.

Advantages

Developers favor bittorrent-tracker because it offers:

  • Zero‑Configuration Flexibility: Works out of the box in Node or browsers with minimal setup.
  • Protocol Compliance & Extensibility: Supports all major tracker types and allows custom parameters or backend storage.
  • Open‑Source Licensing: MIT license permits commercial use without royalties.
  • Performance & Simplicity: Lightweight event‑driven architecture keeps memory usage low while handling thousands of concurrent announces.
  • Ecosystem Integration: Seamless compatibility with WebTorrent, peerflix, and other JavaScript‑centric torrent tools.

Overall, bittorrent-tracker provides a developer‑friendly foundation for building custom BitTorrent infrastructures, whether for private networks, media streaming platforms, or educational experiments.

Open SourceReady to get started?

Join the community and start self-hosting bittorrent-tracker today

Weekly Views

Loading...
Support Us
Most Popular

Infrastructure Supporter

$5/month

Keep our servers running and help us maintain the best directory for developers

Repository Health

Loading health data...

Information

Category
other
License
MIT
Stars
1.9k
Technical Specs
Pricing
Open Source
Database
None
Supported OS
LinuxWindowsmacOS
Author
webtorrent
webtorrent
Last Updated
Sep 6, 2025