UTracker is a high-performance, multi-protocol BitTorrent tracker aggregator built with FastAPI (backend) and React (frontend). It provides a unified platform for aggregating peers across HTTP, UDP, and WebSocket protocols with real-time monitoring capabilities.
- Multi-Protocol Support: HTTP (BEP-3), UDP (BEP-15), and WebSocket tracking
- Real-time Dashboard: React-based UI for monitoring swarm activity and tracker statistics
- Cross-Protocol Peer Aggregation: Aggregates peers across all supported protocols
- Public Tracker Integration: Automatically discovers and validates public trackers
- Performance Metrics: Comprehensive metrics and monitoring capabilities
- Ultra-low Latency: Optimized for high-performance tracker operations
The application consists of:
- Backend: FastAPI server with MongoDB integration supporting HTTP/UDP/WebSocket announce protocols
- Frontend: React dashboard with real-time updates via WebSocket
- Database: MongoDB for persistent storage of statistics and temporary data
- Python 3.8+
- Node.js 16+
- MongoDB
- Docker (optional, for containerization)
- Clone the repository:
git clone https://github.com/your-username/UTracker.git
cd UTracker- Set up the backend:
cd backend
pip install -r requirements.txt- Create a
.envfile in the backend directory:
MONGO_URL=mongodb://localhost:27017
DB_NAME=tracker_db
CORS_ORIGINS=http://localhost:3000
- Start the backend server:
cd backend
uvicorn server:app --host 0.0.0.0 --port 8001- Set up the frontend:
cd frontend
npm install- Create a
.envfile in the frontend directory:
REACT_APP_BACKEND_URL=http://localhost:8001
- Start the frontend:
cd frontend
npm startThe frontend will be available at http://localhost:3000, and the backend API will run on http://localhost:8001.
- Build and run with Docker Compose:
docker-compose up --buildThe application will be accessible at http://localhost (port 80).
The application uses a multi-stage Docker build process:
- Frontend-builder: Builds the React application using Node.js 18
- Backend-builder: Installs Python dependencies and builds the backend
- Backend: Production backend image with FastAPI running on port 8001
- Frontend: Production frontend served by Nginx on port 80
Key ports:
- HTTP tracker: 8001
- UDP tracker: 8002
- Frontend dashboard: 80 (exposed as port 80)
- MongoDB: 27017 (internal only)
The docker-compose.yml defines the following environment variables:
Backend:
MONGO_URL: MongoDB connection URL (mongodb://mongodb:27017)DB_NAME: Database name (tracker_db)CORS_ORIGINS: Comma-separated allowed origins
Frontend:
REACT_APP_BACKEND_URL: Backend API URL (http://localhost:8001)REACT_APP_DOCKER_ENV: Indicates Docker environment (true)
The Docker setup uses nginx to proxy API requests from the frontend to the backend:
- Frontend runs on port 80
- API requests to
/apiare proxied to the backend service - WebSocket connections to
/api/announce_wsare also proxied - This allows the React app to make relative API calls that are handled by nginx
GET /api/announce- HTTP BitTorrent announce (BEP-3)- UDP Port 8002 - UDP BitTorrent announce (BEP-15)
WS /api/announce_ws- WebSocket announce
GET /api/stats- Tracker statisticsGET /api/swarms- Active swarmsGET /api/trackers- Public tracker listPOST /api/scrape_trackers- Refresh tracker listGET /api/metrics- Prometheus metrics
MONGO_URL- MongoDB connection URL (default: mongodb://localhost:27017)DB_NAME- MongoDB database name (default: tracker_db)CORS_ORIGINS- Comma-separated list of allowed CORS origins
REACT_APP_BACKEND_URL- Backend API URL (default: http://localhost:8001)
Run backend tests:
cd backend
python backend_test.py
python additional_tests.pyA multi-stage Docker configuration is provided:
- Backend: Python 3.11 with FastAPI
- Frontend: Node.js 18 with Nginx
- MongoDB: For data persistence
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Make your changes
- Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Based on BEP-3 (BitTorrent Protocol Specification) and BEP-15 (UDP Tracker Protocol)
- Inspired by public tracker lists from ngosang and XIU2