SecureTransfer is a high-performance, real-time file-sharing system built on the WebRTC protocol. It enables fully peer-to-peer (P2P) transfers, ensuring your files never touch a central server.
SecureTransfer uses a Signaling-First, P2P-Second approach. While the server helps peers find each other, it never sees the file data.
sequenceDiagram
participant S as Sender (Peer A)
participant SS as Signaling Server (Node/Socket.io)
participant R as Receiver (Peer B)
S->>SS: Generate Offer
SS->>R: Relay Offer (via Link/Email)
R->>SS: Generate Answer
SS->>S: Relay Answer
Note over S,R: WebRTC Data Channel Open (P2P)
S->>R: Stream File Chunks
Screencast.from.2025-12-18.21-48-23.mov
SecureTransfer relies on WebRTC Data Channels to facilitate direct communication between browsers.
- The Handshake: The Sender creates a room, which generates a unique WebRTC "Offer."
- Signaling: The Receiver joins via a shared link or email invitation. We use a Socket.io signaling server to exchange connection metadata.
- The Connection: Once the peers find each other via STUN servers, the connection becomes purely P2P.
- Note: Success rates for STUN-based connections are typically around 80%. If a connection fails, it is usually due to restrictive firewalls (Symmetric NAT), not the software itself.
- The Transfer: Files are broken into small chunks, sent over the data channel, and reassembled in real-time on the receiver's end.
Handling files over 1GB without crashing the browser was the primary challenge.
- Memory Management: To avoid memory overflow, we don't load the whole file at once. We slice the file into
ArrayBufferchunks. - Reassembly: On the receiver side, we manage
Uint8Arrayfragments, ensuring they are reassembled in the correct order to maintain file integrity.
- Frontend: React (UI & WebRTC implementation)
- Signaling Server: Node.js (Express & Socket.io)
- Email Queue: BullMQ + Redis (Handles invitation delivery)
- **UI Design and implementation is done by Kushal Aryal
Access the UI
- Frontend: http://localhost/5173
// run command from the root
docker compose up -d
- Node.js installed
- Redis server running (for BullMQ)
cd backend
npm install
# Configure your .env file (see .env.example)
npm run dev
cd backend
npm run workercd frontend
npm install
npm run dev
Love it! Give it a star.