Skip to content

Minimal BitTorrent client in Node.js – tracker communication, peer list, torrent parsing and downloading files from peers

Notifications You must be signed in to change notification settings

xonas1101/BitTorrent-Client-XT

Repository files navigation

BitTorrent-Client-XT

Minimal BitTorrent client in Node.js – tracker communication, peer list, torrent parsing and downloading files from peers

🚀 BitTorrent Client in Node.js

A fully functional BitTorrent client built from scratch using Node.js. This project demonstrates how the BitTorrent protocol works at a low level, including tracker communication (UDP & HTTP), torrent file parsing, peer discovery, and file downloading via the peer wire protocol.


📌 Overview

This BitTorrent client is designed for educational and experimental purposes. It covers the entire flow of downloading files using .torrent metadata:

  • Parses .torrent files
  • Communicates with trackers to discover peers
  • Connects to peers using the BitTorrent wire protocol
  • Requests and downloads file pieces from peers
  • Assembles and saves the complete file(s) locally

🧠 Core Features

  • ✅ Torrent file parsing (bencode decoding)
  • ✅ Tracker communication (UDP and HTTP)
  • ✅ Peer discovery and peer list extraction
  • ✅ Peer wire protocol (handshake, bitfield, request, piece, etc.)
  • ✅ Piece selection and reassembly
  • ✅ File download and save to disk
  • 🛠️ Error handling and reconnection logic
  • 📊 Logging for all major events (trackers, peers, progress, etc.)

🔧 Technologies Used

  • Node.js (v18+ recommended)
  • Core modules: net, dgram, fs, crypto, events, buffer
  • Custom bencode parser
  • Minimal dependencies – built from scratch to understand internals

About

Minimal BitTorrent client in Node.js – tracker communication, peer list, torrent parsing and downloading files from peers

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published