P2P WebRTC File Share

Full Stack
Web Dev
Backend
P2P WebRTC File Share

Tech Stack

FastAPI
WebSockets
WebRTC
Python
JavaScript

Description

Built a direct peer-to-peer file sharing application that guarantees privacy by ensuring no files are uploaded to any central server.

The architecture leverages FastAPI and WebSockets exclusively for signaling (exchanging connection details like SDP offers/answers and ICE candidates).

Once a WebRTC connection is established, files are chunked into 16KB packets and sent directly via DataChannels from the uploader to the downloader, after which they are reassembled locally.

  • FastAPI and WebSockets for real-time signaling and room management
  • WebRTC DataChannels for secure, direct P2P data transfer
  • No server-side file storage; fully decentralized transfer
  • Binary chunking and local reassembly using browser Blob APIs
  • Real-time peer presence and offline state handling

Page Info

Room Join & Signaling

Users join a room via WebSocket. The FastAPI server manages room state and relays WebRTC signaling data (offer, answer, ICE candidates) between peers.

/projects/file-share/signaling.png

P2P DataChannel Transfer

Files are transferred directly between peers using WebRTC DataChannels in 16KB chunks, bypassing the server entirely for maximum privacy.

/projects/file-share/transfer.png