TopGit
GitHub Repo Review

bittorrent-tracker: a BitTorrent tracker library

webtorrent/bittorrent-tracker
BTopGit review image for webtorrent/bittorrent-tracker
Review by Topgit.dev for webtorrent/bittorrent-tracker, with GitHub repository stats and README context.
Quick verdict

bittorrent-tracker is a Node.js library implementing the BitTorrent tracker protocol for both client and server, covering HTTP, UDP, and WebSocket transports in one codebase. Reach for it when you need a tracker server or a client that talks to one, in Node or in the browser, without writing the wire protocol by hand. Skip it if you need DHT-based peer discovery instead of a central tracker; that's a separate package.

Stars
โ˜… 1.9k
Forks
โ‘‚ 331
Contributors
๐Ÿ‘ฅ 66
Language
JavaScript
License
MIT
Topic
Backend
Updated
Sep 2026

Understanding bittorrent-tracker

bittorrent-tracker is an npm package containing a Node.js implementation of a BitTorrent tracker, the service that BitTorrent clients report progress to and get a peer list from. It bundles a client and a server, and the server speaks HTTP, UDP, and WebSocket at once, covering both classic BitTorrent clients and browser-based WebTorrent peers.

Core capabilities and supported protocols

  • โœ“Bundles both client and server implementations in one package, per the README.
  • โœ“Supports HTTP trackers, UDP trackers (BEP 15), and WebTorrent's WebSocket tracker protocol, covering both classic BitTorrent clients and browser peers.
  • โœ“Handles both IPv4 and IPv6 addressing, per the README.
  • โœ“Implements the tracker scrape extension for querying swarm stats without a full announce.
  • โœ“Ships a test suite that the README says runs completely offline.
  • โœ“Exposes tracker statistics through a web interface at /stats and as JSON at /stats.json.
  • โœ“The client's optional proxyOpts route WSS, UDP (via SOCKS), and HTTP tracker requests through a proxy.
How this repository's GitHub stars have grown over time. Source: star-history.com.View the star history โ†—

Installation and setup

Install with `npm install bittorrent-tracker` to use it as a client/server library inside a Node or browser project. To run the standalone CLI tracker server, install it globally instead: `npm install -g bittorrent-tracker`, which adds a `bittorrent-tracker` command. Running that command with no flags starts HTTP, UDP, and WebSocket servers together on port 8000 by default; pass `--help` to see the full flag list, including `-p`/`--port` to change the port and `--trust-proxy` to trust the `x-forwarded-for` header behind a reverse proxy.

Strengths

  • โœ“One package covers both tracker client and server code, so you don't need separate libraries to test your own tracker against your own client.
  • โœ“Three transports in one server: HTTP, UDP, and WebSocket can all run from the same Server instance, per the README's udp/http/ws options.
  • โœ“The scrape extension plus the /stats and /stats.json endpoints give visibility into swarm size without writing custom accounting.
  • โœ“The filter option is a real hook for building a private or whitelisted tracker, with access to the full request params inside the callback.
  • โœ“The README says the client is used by other real projects: WebTorrent, peerflix, and playback.

Scope and considerations

  • โ–ณThe README doesn't give a BEP number for the WebTorrent WebSocket tracker protocol; it's marked as 'BEP forthcoming,' so that half isn't formally standardized yet.
  • โ–ณThe server's filter callback is the only access-control mechanism described; there's no built-in authentication, rate limiting, or persistence layer in the README.
  • โ–ณNo documented benchmarks exist for peer or torrent scale.
  • โ–ณThe HTTP server only answers `/announce` and `/scrape`; anything else goes unhandled, per the README.
  • โ–ณProxy behavior differs by Node version (undici Agent on Node 16+, http.Agent before that) but only appears as a code comment in the client options, not a full explanation.

Other BitTorrent tracker solutions

WebTorrent โ€” the streaming BitTorrent client/CLI/library this tracker package is built to serve, per the README.bittorrent-dht โ€” a separate npm package the README points to for distributed peer discovery without a central tracker.opentracker โ€” a widely deployed C-based BitTorrent tracker daemon, an option if you want tracker infrastructure outside the Node.js ecosystem.Chihaya โ€” a Go-based BitTorrent tracker server, another non-Node option for running tracker infrastructure.

Common questions

What BitTorrent protocols does bittorrent-tracker support?

bittorrent-tracker supports HTTP trackers, UDP trackers (BEP 15), and WebTorrent's WebSocket-based tracker protocol, plus the tracker scrape extension for swarm statistics, all from the same server instance.

Can bittorrent-tracker be used in a web browser?

The client half of bittorrent-tracker runs in the browser as well as Node.js, and its optional `rtcConfig` and `wrtc` settings support the WebRTC connections that browser-based WebTorrent peers use to reach each other.

How can I get statistics from the tracker server?

bittorrent-tracker's server exposes a web-based statistics page at `/stats` and the same data as JSON at `/stats.json` when the `stats` option is enabled, and the client can call `scrape()` for per-torrent seeder, leecher, and download counts.

What is the license for bittorrent-tracker?

bittorrent-tracker is released under the MIT license, copyright Feross Aboukhadijeh and WebTorrent, LLC.

Can I filter which torrents are allowed on the tracker server?

bittorrent-tracker's Server constructor accepts a `filter` callback that gets the info hash, request params, and an async callback, letting you allow or reject torrents by info hash, peer ID, or a secret key before the tracker responds.

Does bittorrent-tracker support IPv6?

bittorrent-tracker's README lists IPv6 support alongside IPv4 for both the client and server sides of the tracker protocol.

The problem it solves

Browser-based BitTorrent clients like WebTorrent can't open a raw UDP socket or an arbitrary TCP connection the way a native BitTorrent client can, so they can't talk to a plain HTTP or UDP tracker directly. bittorrent-tracker's server answers over WebSocket as well as HTTP and UDP from the same process, and its client speaks whichever protocol the tracker in `announce` uses, so one Node codebase can serve or contact trackers for both browser and native peers instead of needing separate tracker software per protocol.

Best use cases

  • โ€ขRunning your own BitTorrent tracker server for an app you control, using the CLI or the Server class instead of depending on a public tracker.
  • โ€ขBuilding a WebTorrent-style browser app that needs a client library to announce to trackers over WebSocket and pull peer lists.
  • โ€ขBuilding a private tracker that whitelists specific torrents, using the server's filter callback to allow or block by info hash, peer ID, or a secret key.
  • โ€ขPulling live swarm stats (seeders, leechers, downloads) for one or more torrents via the client's scrape() method or the server's /stats.json endpoint.

How to use

As a client, import `Client` from `bittorrent-tracker`, construct it with an `infoHash`, a `peerId`, a list of `announce` URLs, and a `port`, then call `client.start()` to begin announcing; listen for `'peer'` events to get addresses of other swarm members and `'update'` events for seeder/leecher counts, and call `client.stop()` or `client.destroy()` to leave the swarm gracefully or immediately. As a server, import `Server` and construct it with `udp`, `http`, `ws`, and `stats` booleans to choose which transports run, then call `server.listen(port, hostname)`; the running instance exposes `server.torrents`, keyed by info hash, with `complete`, `incomplete`, and `peers` fields per torrent, and only responds to `/announce` and `/scrape` requests. From the command line, running the globally installed `bittorrent-tracker` binary with no flags starts all three transports on port 8000, and `--http`, `--udp`, or `--ws` flags let you run just one.

Who should try it โ€” and who should skip

Try bittorrent-tracker if you're building anything that needs to run or talk to a BitTorrent tracker from Node or the browser: a WebTorrent-style app, a private tracker with torrent whitelisting, or test infrastructure for other BitTorrent tooling. Skip it if you want tracker-free swarm discovery via DHT, since that's a separate package (bittorrent-dht) and a different protocol, or if you need a tracker built outside the Node.js ecosystem for a non-JS deployment.

Related repositories

Source & attribution

Facts and quotes sourced from the webtorrent/bittorrent-tracker GitHub repository and its README.

GitHub data ยท last synced Aug 12, 2026Reviewed by Henry
โ† Back to TopGit

Curious whether bittorrent-tracker is right for you?

Let ChatGPT, Claude, or Perplexity look into it โ€” click below and see what AI actually says about bittorrent-tracker.

GitHub