A lightweight and efficient BitTorrent tracker implemented in TypeScript, using the Bun runtime and Express.
- Full BitTorrent tracking functionality
Implements the BitTorrent tracker protocol with announce, scrape, and stats endpoints. - Peer management
Tracks active seeders and leechers for each torrent. - State persistence
Automatically saves and loads tracker state to survive restarts. - Automatic cleanup
Removes inactive peers to keep memory usage optimal. - Compact responses
Supports compact peer lists for bandwidth efficiency. - Docker support
Ready for containerized deployment. - Configurable
Environment variables allow you to customize your tracker setup.
- Bun runtime
# Clone the repository
git clone https://github.com/team-tritan/bittorrent-tracker.git
cd bittorrent-tracker
# Install dependencies
bun install
# Start the tracker
bun start
# Clone the repository
git clone https://github.com/team-tritan/bittorrent-tracker.git
cd bittorrent-tracker
# Start with Docker Compose
docker-compose up -d
Configure the tracker using environment variables in a .env file:
PORT— Port the tracker will listen onDATA_DIR— Directory to store persistent dataCLEANUP_INTERVAL— Interval for cleaning up inactive peers (in ms)
Used by BitTorrent clients to announce their presence and receive peer lists.
Query Parameters:
info_hash— Hash of the torrent (required)peer_id— Client's peer ID (required)port— Client's listening port (required)uploaded— Bytes uploadeddownloaded— Bytes downloadedleft— Bytes left to downloadcompact— Use compact peer list format (0 or 1)event— Client event (started,completed,stopped, orpaused)
Returns statistics about one or more torrents.
Query Parameters:
info_hash— Hash of the torrent (optional, can be specified multiple times)
Returns a summary of statistics about all tracked torrents.
Returns detailed statistics about all tracked torrents.
To use this tracker with qBittorrent:
- Open a torrent's Properties
- Go to the Trackers tab
- Add:
http://your-server-ip:8080/announce
Alternatively:
- Go to Options → Downloads
- Add the tracker URL to the setting that appends it to each download automatically