bittorrent-tracker Client and Server Guide
🌊 Simple, robust, BitTorrent tracker (client & server) implementation
At a glance
- What is it?
- bittorrent-tracker is a JavaScript package for announcing to and operating BitTorrent trackers over HTTP, UDP, and WebTorrent transports. It fits Node.js and browser applications that need peer discovery and swarm statistics, with server filtering available for private torrents.
- Who is it for?
- Adopt bittorrent-tracker when an application needs a programmable tracker protocol client, a compact private tracker, or browser-oriented WebTorrent discovery. Do not treat its included server as a complete public tracker without first checking persistence, scaling, access control, proxy handling, and abuse controls.
- Can I use it commercially?
- Yes. MIT is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
- Is it still maintained?
- Yes. The repository last received commits 8 days ago.
- What is it written in?
- Mainly JavaScript, according to GitHub's language statistics.
Answers come from the project's GitHub data, last synced on October 23, 2026, and from our analysis. They are not legal advice.
Editorial analysis
Why bittorrent-tracker serves private swarms and browser clients
bittorrent-tracker addresses both sides of BitTorrent peer discovery. Applications use its client implementation to announce torrent activity to existing trackers and receive peer addresses. Operators can use its server implementation to accept those announcements and return peer lists for individual torrent infohashes. This makes the package relevant to private torrent communities, Node.js download tooling, WebTorrent applications, and projects that want control over tracker behavior instead of depending only on a public service.
The tracker does not download torrent content itself. Its role is coordination. Clients report metrics such as `uploaded`, `downloaded`, and `left`, while the tracker returns swarm information including `complete` and `incomplete` counts and a set of peer addresses. That distinction matters when evaluating the package: it solves discovery and swarm bookkeeping, not file transfer, magnet-link parsing, peer-wire behavior, or tracker data storage.
The package supports HTTP, UDP under BEP 15, and WebTorrent-style tracker connections. IPv4 and IPv6 are listed as supported features. Scrape requests expose aggregate torrent statistics, while the server can publish a web statistics view at `/stats` or JSON output at `/stats.json`. The README identifies WebTorrent as a user of the module, which is useful context, but the repository does not provide adoption figures or detailed deployment case studies.
Client announces, update events, and peer discovery
The client is constructed with the torrent identity and tracker endpoints. `infoHash` and `peerId` identify the torrent and client, `announce` contains tracker URLs, and `port` identifies the client's torrent port. In browsers, the port is optional. After construction, `client.start()` begins tracker activity, and the client emits `update` when an announce response is received. It emits `peer` when it finds a peer address.
The client separates recoverable tracker trouble from fatal errors. The `warning` event represents an unavailable tracker or malformed tracker data, while `error` represents a fatal client error. This distinction gives an application a place to tolerate one failed tracker without treating every announcement problem as a complete client failure. The package also accepts optional settings for `rtcConfig`, `userAgent`, proxy agents, and a custom WebRTC implementation in Node.js.
Lifecycle calls matter. `complete()` announces that the client has finished downloading and is now a seeder. `update()` forces an announcement, optionally with per-call parameters. `stop()` leaves the swarm gracefully, while `destroy()` leaves without sending a final stop message. The distinction can affect how another server removes a stopped peer from its active set. The README does not document exact announce intervals or retry timing, so an application should not assume either without consulting the client implementation and tests.
HTTP, UDP, WebTorrent, and scrape data paths
The protocol support is a practical reason to consider this package. An application can announce against different tracker transport types through the same client abstraction, while the server can enable UDP, HTTP, and WebSocket listeners independently. The server example uses `udp`, `http`, `ws`, and `stats` options, all documented with defaults of `true`. A deployment can therefore expose selected protocols, although the README example does not show a complete listening configuration or public address setup.
Proxy handling differs by transport. The README documents `http.Agent` for WebSocket and older Node.js HTTP cases, an `undici` dispatcher for Node.js 16 or later, and a Socks agent or dispatcher for UDP proxy requests. This is useful for applications behind a controlled network, but proxy integration is not one universal option. The client must be configured for the actual transport and Node.js version.
Scrape is separate from ordinary peer discovery. `client.scrape()` requests torrent statistics, and the `scrape` event reports `complete`, `incomplete`, and `downloaded`. The server's `/stats` and `/stats.json` endpoints provide operator-facing statistics, but the README does not define authentication, retention, pagination, or production hardening for them. Those endpoints should not be treated as a complete monitoring or access-control design without checking the server code and deployment configuration.
Server filtering and private-tracker constraints
The server includes an asynchronous `filter` callback. It receives `infoHash`, request parameters, and a callback. Calling `cb(null)` allows the torrent. Passing an `Error` denies it and uses the error message as the rejection reason. When the option is omitted, all torrents are allowed. The README also states that the callback can block by peer ID or secret key for private trackers, and can access the original HTTP or UDP request parameters.
That default is important. An unfiltered server accepts every torrent submitted to it. A private tracker therefore needs an explicit filter, and the filter must make the correct authorization decision before calling the callback. The example compares an infohash with one allowed value, but it is only an example, not a complete access-control policy.
The server is an in-process JavaScript service, not a documented distributed tracker cluster. The README does not state that swarm state is persisted to a database, replicated between nodes, or recovered after a restart. It also does not document rate limiting, abuse controls, quotas, or horizontal scaling. Those omissions matter when comparing the package with a managed or infrastructure-oriented tracker service.
Installing and performing a first announce
The README gives one installation command. Run it in the project that needs the client or server. The package metadata requires Node.js `>=16.0.0` and identifies the package as an ES module through `"type": "module"`. The example below follows the documented client setup, using its sample identity values. A real application must replace them with its own torrent and tracker values.
npm install bittorrent-trackerThe client import and required options are shown below. The `announce` array should contain tracker server URLs that the application can reach. The sample values are not deployment defaults.
import Client from 'bittorrent-tracker'
const client = new Client({
infoHash: new Buffer('012345678901234567890'),
peerId: new Buffer('01234567890123456789'),
announce: [],
port: 6881
})After defining event handlers, call `start()` and listen for `update` and `peer`. The `update` handler reports a successful tracker interaction, while `peer` exposes an address returned by the tracker. An application should handle `error` separately from `warning`, because the README defines those events differently.
client.on('error', function (err) {
console.log(err.message)
})
client.on('warning', function (err) {
console.log(err.message)
})
client.start()
client.on('update', function (data) {
console.log('got an announce response from tracker: ' + data.announce)
})
client.once('peer', function (addr) {
console.log('found a peer: ' + addr)
})When the download finishes, call `client.complete()`. During application shutdown, use `client.stop()` when a final graceful leave is required. The package metadata defines a `bittorrent-tracker` executable entry pointing to `./bin/cmd.js`, but the README does not document its command-line usage, so that entry should not be presented as a ready-made server command without checking `bin/cmd.js`.
When bittorrent-tracker is the wrong tool
The clearest limitation is the gap between an embeddable tracker library and a complete public tracker deployment. The README documents protocol handling, filtering, statistics, and WebTorrent integration, but it does not document durable storage, tracker replication, management-interface authentication, abuse prevention, or a production deployment guide. A service expecting these guarantees would need to supply and evaluate them separately.
The package is also not a torrent downloader. It returns peer addresses and tracker statistics, but it does not fetch or assemble torrent pieces. Projects needing file transfer should use a higher-level application that integrates tracker discovery with peer connections. The dependency list includes WebRTC and networking components, but the tracker package's purpose remains swarm coordination.
A higher-capacity tracker service is a different architectural choice because it can provide documented persistence, replication, and operational controls outside the application process. bittorrent-tracker instead embeds tracker client and server behavior in JavaScript, which suits small private swarms and applications that need programmable transport handling. The README's named WebTorrent use establishes relevance, but it does not establish suitability for large-scale operation.
MIT licensing, upgrades, and release state
The repository uses the MIT license. It permits use, modification, distribution, and private commercial work subject to the license terms, including preservation of the copyright and license notice. This is a licensing summary rather than legal advice. The repository includes a `LICENSE` file, so an integrating organization should review that file during its release process.
The repository is not archived, and its last push was on 2026-10-15. Recent releases include v11.2.3 on 2026-05-25, v11.2.2 on 2025-09-06, and v11.2.1 on 2025-01-19. These are concrete maintenance signals, but release dates do not by themselves establish compatibility or operational suitability. The package requires Node.js `>=16.0.0`, while dependencies include ranges such as `@thaunknown/simple-peer` and `ws`.
Upgrading requires checking `CHANGELOG.md` and the changes associated with the selected release. The repository does not include a complete migration guide for every major version, nor does the README describe compatibility guarantees across Node.js releases, proxies, browsers, or WebRTC implementations. Version selection should therefore account for both the application's Node.js version and its chosen tracker transports.
Editorial conclusion
Adopt bittorrent-tracker when an application needs a programmable tracker protocol client, a compact private tracker, or browser-oriented WebTorrent discovery. Do not treat its included server as a complete public tracker without first checking persistence, scaling, access control, proxy handling, and abuse controls. For an initial integration, verify the Node.js version, announce URLs, transport configuration, and lifecycle calls. The MIT-licensed package is most suitable when its in-process server model matches the deployment plan.
Frequently asked questions
How do I install bittorrent-tracker?
The README documents `npm install bittorrent-tracker`. The package metadata specifies Node.js `>=16.0.0`.
Which tracker protocols does bittorrent-tracker support?
It supports HTTP trackers, UDP trackers under BEP 15, and WebTorrent trackers. The server example can enable UDP, HTTP, and WebSocket listeners.
How do I create a private BitTorrent tracker with bittorrent-tracker?
Create a `Server` and provide an asynchronous `filter` function. The README says that `cb(null)` allows a torrent, while passing an `Error` rejects it and exposes the error message as the reason.
Official sources
Add this badge to your README
If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.
[](https://hysenlabs.com/projects/webtorrent-bittorrent-tracker)Was this useful?