A browser-based peer-to-peer file sharing application utilizing WebRTC mesh networking and BitTorrent v2 protocol with custom extensions.
- Bun runtime (for servers)
- Node.js/npm (for client)
- OpenSSL (for certificates)
# Start all components as binaries
./start-testbed.sh# Check if everything is running properly
./check-testbed.sh- Client App: https://kollator.local:5173 (requires certificate trust)
- Signaling Server: https://kollator.local:8000 (requires certificate trust)
Kollator implements a "Ticket Booth Architecture":
- Front Servers (
server/signaling/): Handle WebRTC signaling and client bootstrapping - Workers (
server/worker/): Provide persistent storage and data retrieval - Clients (
client/): Browser-based file management and P2P transfers
- ✅ Basic WebRTC signaling between components
- ✅ Binary startup scripts for performance
- ✅ SSL certificate generation
⚠️ File chunking needs optimization (see below)- ❌ BitTorrent DHT integration (planned)
- ❌ S3 storage integration (planned)
- ❌ OPFS client storage (planned)
The file chunking needs work due to WebRTC DataChannel limitations:
- Issue: feross/simple-peer#561
- Solution: Use 16KB chunks as recommended
- Module: https://www.npmjs.com/package/chunk-stream
var chunks = require('chunk-stream')
inputStream.pipe(chunks(16000)).pipe(peer)
// or with write:
var chunkStream = chunks(16000)
chunkStream.pipe(peer)
chunkStream.write(myData)References:
-
Certificate Trust Issues
# Add certificate to browser trust store # Chrome: Settings > Privacy > Manage Certificates > Authorities # Import: certs/_wildcard.kollator.local+3.pem
-
DNS Resolution
# Ensure kollator.local resolves echo "127.0.0.1 kollator.local" | sudo tee -a /etc/hosts
-
Port Conflicts
# Check what's using ports lsof -i :8000 # Signaling server lsof -i :5173 # Client dev server
All logs are stored in the logs/ directory:
signaling.log- Front server logsworker1.log- Worker server logsclient.log- Client dev server logs
If the startup script doesn't work, start components manually:
# Terminal 1: Signaling Server
cd server/signaling && bun run index.ts
# Terminal 2: Worker
cd server/worker && bun run index.ts
# Terminal 3: Client
cd client && npm run devTo fully implement the PDR requirements:
-
File Processing Pipeline
- Implement 5MB file chunking
- Add BitTorrent v2 hash generation
- Create .ko torrent file format
-
DHT Integration
- Add
webtorrent/bittorrent-dhtto all components - Implement chunk discovery and announcement
- Add
-
Storage Systems
- Integrate S3/Wasabi for worker persistent storage
- Implement OPFS for client-side storage
- Add LRU caching for workers
-
Advanced Features
- Consistent hashing for worker assignment
- cr-sqlite for front server synchronization
- Fault tolerance and automatic recovery
See individual component READMEs for detailed development information: