A browser-based P2P file sharing demo using WebRTC data channels with a WebSocket signaling server and a 4-digit PIN pairing flow.
Explore the docs »
English
View Demo | Report Bug | Request Feature
Table of Contents
This project is a lightweight peer-to-peer file sharing web app. It uses WebRTC data channels to send files directly between browsers and a small WebSocket signaling server to exchange offers, answers, and ICE candidates. A 4-digit PIN makes pairing simple and prevents cross‑talk when multiple users are online.
- Direct browser-to-browser file transfer via WebRTC
- 4-digit PIN pairing to connect the right devices
- Works across tabs or devices on the same network
- Simple signaling server for offers/answers/ICE candidates
- Clean, guided UI with “How to Use” steps
- Node.js 18+
- npm (ships with Node.js)
- Clone the repo
git clone https://github.com/17addisonlin/Peer-to-Peer-File-Sharing-System.git
- Install dependencies
npm install
- Start the signaling server
node server.js
- Serve the frontend in a second terminal
npx serve ./public
- Open the URL from
servein two tabs or devices.
- Open the site on two tabs or devices (same Wi‑Fi recommended).
- On the receiving device, click Start Receiving to generate a 4‑digit PIN.
- On the sending device, enter that PIN, choose a file, and click Send File.
- The receiver gets a download link when the transfer completes.
- Either side can send again without refreshing.
- “Upgrade Required” in the browser: you opened the WebSocket server directly. Use the static server URL (from
npx serve ./public). - No connection or file transfer: verify both tabs show “Connected to signaling server” in the console.
- Works on one machine but not between devices: ensure both devices are on the same network and use the same host IP in the static server URL.
- Room is full: only two peers can join the same PIN at once.
- Transfers are peer-to-peer; the signaling server never sees the file contents.
- A 4‑digit PIN is meant for convenience, not strong security. For sensitive files, use a longer PIN or add authentication.
- For use across the public internet, you will likely need a TURN server.
- File metadata (name, size, type) shown on receive
- Progress bar and transfer speed indicators
- Optional 6‑digit PIN / time‑limited rooms
- TURN server support for NAT traversal
See the open issues for a full list of proposed features and known issues.
Contributions are welcome. If you have improvements or bug fixes, please open an issue or submit a pull request.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature) - Commit your Changes (
git commit -m 'Add some AmazingFeature') - Push to the Branch (
git push origin feature/AmazingFeature) - Open a Pull Request
Distributed under the MIT License. See LICENSE for more information.
Addison Lin - LinkedIn
Project Link: https://github.com/17addisonlin/Peer-to-Peer-File-Sharing-System

