Skip to content
mayanksingh05Public

About

Real-Time Peer-to-Peer File Transfer System using WebRTC, FastAPI and WebSockets

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

Β 

History

59 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

DropNova Banner

⚑ DropNova

Real-Time Peer-to-Peer File Transfer using WebRTC

Transfer files directly between devices without uploading them to a cloud server.

HTML CSS JavaScript FastAPI WebRTC WebSocket Render Netlify License

🌐 Live Demo


πŸ“– Table of Contents

  • About DropNova
  • Why I Built This
  • Features
  • Screenshots
  • System Architecture
  • WebRTC Connection Flow
  • File Transfer Flow

πŸš€ About DropNova

DropNova is a browser-based peer-to-peer file sharing application that allows users to securely transfer files directly between two devices using WebRTC DataChannels.

Unlike traditional file sharing services, files are never uploaded to the server. The backend is used only for signaling, while the actual file travels directly from one browser to another.

This provides:

  • Faster transfers
  • Better privacy
  • Lower server bandwidth
  • Zero cloud storage
  • Cross-platform compatibility

The application works directly inside the browser without requiring software installation.


πŸ’‘ Why I Built DropNova

The idea came from a real-world problem.

During a hackathon, I frequently needed to share files with teammates and mentors using different laptops.

The common options were surprisingly inconvenient:

  • Connect my phone through a USB cable
  • Upload files to Google Drive
  • Send files through WhatsApp
  • Share my personal phone number
  • Install a common file-sharing application on both devices

None of these felt quick or practical, especially when sharing files with someone I had just met.

I wanted something much simpler.

Open a website.

Generate a pairing code.

Connect two devices.

Transfer the files.

Done.

No login.

No registration.

No account.

No cloud upload.

No phone number.

No installation.

That idea became DropNova.


✨ Features

  • ⚑ Direct Peer-to-Peer file transfer using WebRTC
  • πŸ” Secure browser-to-browser communication
  • 🌐 FastAPI WebSocket signaling server
  • πŸ“± QR Code based device pairing
  • πŸ”’ 6-digit pairing code
  • πŸ“‚ Multiple file transfer support
  • πŸ“Š Live transfer progress
  • 🚫 Transfer cancellation
  • πŸ”„ Resume support for interrupted transfers
  • πŸ’Ύ Native File System Access API support
  • πŸ“ OPFS fallback for browsers without File System Access API
  • πŸ“± Mobile browser compatibility
  • πŸŒ™ Dark theme UI
  • 🌍 Cross-network support using STUN
  • ⚑ Same-network optimized transfers
  • 🧹 Automatic memory cleanup
  • πŸ—‘ Automatic session cleanup
  • πŸ”Œ Automatic disconnect handling
  • πŸ‘₯ One sender and one receiver per session
  • πŸ“¦ Chunk-based file transfer
  • πŸš€ Browser-based application (no installation required)
  • πŸ”’ Files never pass through the backend server

πŸ“Έ Screenshots

🏠 Home

Home


πŸ“€ Sender Pairing

Sender Pair


πŸ“₯ Receiver Pairing

Receiver Pair


πŸ”— Devices Connected

Connected


πŸ“€ Sending Files

Sending


πŸ“₯ Receiving Files

Receiving


βœ… Transfer Complete

Completed


πŸ’‘ Light Theme

Light Theme


πŸ“± Mobile Interface

Mobile


πŸ— System Architecture

DropNova follows a hybrid architecture.

The backend only performs signaling between peers.

Once signaling is complete, both browsers establish a direct WebRTC DataChannel and communicate without routing file data through the server.

This significantly reduces backend bandwidth while increasing transfer speed and privacy.


πŸ”„ WebRTC Connection Flow

Connection Establishment:

  1. Sender generates a 6-digit pairing code.
  2. Receiver joins using the code or QR Code.
  3. Both devices connect to the FastAPI signaling server.
  4. SDP Offer and Answer are exchanged.
  5. ICE Candidates are exchanged.
  6. WebRTC DataChannel is established.
  7. The signaling server is no longer involved in the file transfer.

πŸ“‚ File Transfer Flow

Each file transfer follows this sequence:

  1. Sender selects one or more files.
  2. Receiver receives a transfer request.
  3. Receiver accepts the transfer.
  4. Files are divided into chunks.
  5. Chunks are streamed over the WebRTC DataChannel.
  6. Progress is synchronized in real time.
  7. Receiver acknowledges successful completion.
  8. Both devices clean temporary resources automatically.

βš™οΈ Project Architecture

DropNova follows a lightweight hybrid architecture that separates the responsibilities of connection establishment and file transfer.

The backend is responsible only for signaling. It creates temporary communication rooms where two peers exchange the information required to establish a direct WebRTC connection.

Once the WebRTC DataChannel is established, the backend is no longer involved in the transfer process. Every file travels directly between the sender and receiver, reducing server bandwidth while improving speed and privacy.

The application consists of four major components:

  • Frontend (HTML, CSS & JavaScript) β€” Handles the user interface, routing, QR code generation, progress tracking, and file management.
  • FastAPI Signaling Server β€” Exchanges SDP Offers, Answers, and ICE Candidates through WebSockets.
  • WebRTC DataChannel β€” Creates the secure peer-to-peer connection used to transfer file data.
  • Browser Storage APIs β€” Uses the Native File System Access API where supported and OPFS as a fallback for compatible browsers.

⚑ How DropNova Works

Step 1 β€” Open the Website

The sender opens DropNova and chooses Send File.

The receiver opens the same website and chooses Receive File.


Step 2 β€” Pair the Devices

The sender generates:

  • A unique 6-digit pairing code
  • A QR Code containing the pairing information

The receiver can either:

  • Enter the 6-digit code manually
  • Scan the QR code

This creates a temporary signaling room.


Step 3 β€” WebSocket Signaling

Both browsers establish a WebSocket connection with the FastAPI signaling server.

The server is responsible only for exchanging:

  • SDP Offer
  • SDP Answer
  • ICE Candidates

No file data passes through the backend.


Step 4 β€” WebRTC Connection

After signaling completes, both browsers establish a secure WebRTC DataChannel.

At this point:

  • The connection becomes peer-to-peer.
  • The signaling server is no longer involved.
  • Files travel directly between both devices.

Step 5 β€” File Selection

The sender selects one or multiple files.

DropNova supports:

  • Single file transfer
  • Multi-file transfer
  • Different file types
  • Batch transfers

Step 6 β€” Transfer Request

Before any file is transferred, the receiver receives a confirmation prompt displaying:

  • File names
  • File sizes
  • Number of files

The receiver can:

  • Accept
  • Decline

This prevents unwanted transfers.


Step 7 β€” Chunk-Based Transfer

Instead of sending an entire file at once, DropNova divides every file into smaller chunks.

Chunk-based transfer provides several advantages:

  • Lower browser memory usage
  • Better transfer stability
  • Accurate progress tracking
  • Resume capability
  • Improved handling of large files

Each chunk is streamed through the WebRTC DataChannel until the entire file has been transferred.


Step 8 β€” Progress Tracking

During transfer, both devices display:

  • Transfer percentage
  • Live progress bar
  • Current transfer status

The sender and receiver remain synchronized throughout the transfer.


Step 9 β€” Transfer Completion

Once the final chunk is received:

  • The receiver reconstructs the original file.
  • The sender receives an acknowledgement.
  • Temporary resources are cleaned automatically.
  • Both users can immediately transfer another file without reconnecting.

πŸ›  Tech Stack

Frontend

  • HTML5
  • CSS3
  • Tailwind CSS
  • JavaScript (ES6 Modules)

Browser APIs

  • WebRTC
  • WebSocket
  • File System Access API
  • Origin Private File System (OPFS)
  • QRCode.js

Backend

  • Python
  • FastAPI
  • WebSockets (Starlette)

Deployment

  • Netlify (Frontend)
  • Render (Backend)

Development Tools

  • Git
  • GitHub
  • VS Code

πŸ“ Project Structure

DropNova
β”‚
β”œβ”€β”€ backend
β”‚   β”œβ”€β”€ main.py
β”‚   └── requirements.txt
β”‚
β”œβ”€β”€ frontend
β”‚   β”œβ”€β”€ screens
β”‚   β”‚   β”œβ”€β”€ home.js
β”‚   β”‚   β”œβ”€β”€ send.js
β”‚   β”‚   β”œβ”€β”€ receive.js
β”‚   β”‚   β”œβ”€β”€ connected.js
β”‚   β”‚   β”œβ”€β”€ sending.js
β”‚   β”‚   β”œβ”€β”€ receiving.js
β”‚   β”‚   β”œβ”€β”€ completed.js
β”‚   β”‚   └── reconnect.js
β”‚   β”‚
β”‚   β”œβ”€β”€ app.js
β”‚   β”œβ”€β”€ router.js
β”‚   β”œβ”€β”€ transfer.js
β”‚   β”œβ”€β”€ fileTransfer.js
β”‚   β”œβ”€β”€ webrtc.js
β”‚   β”œβ”€β”€ style.css
β”‚   └── index.html
β”‚
β”œβ”€β”€ screenshots
β”œβ”€β”€ docs
β”œβ”€β”€ README.md
β”œβ”€β”€ LICENSE
└── .gitignore

πŸš€ Running Locally

Clone the Repository

git clone https://github.com/mayanksingh05/dropnova.git
cd dropnova

Backend

cd backend
pip install -r requirements.txt
uvicorn main:app --reload

The signaling server will start on:

http://localhost:8000

Frontend

Open another terminal.

cd frontend
python -m http.server 5500

or

npx serve

Open:

http://localhost:5500

Update the WebSocket URL inside:

frontend/screens/send.js
frontend/screens/receive.js

Replace:

wss://your-backend-url/ws/

with

ws://localhost:8000/ws/

for local development.


☁️ Deployment

Frontend

Deploy the frontend on Netlify.


Backend

Deploy the FastAPI signaling server on Render.


After deployment, update the frontend WebSocket endpoint to point to your deployed backend.


🎯 Design Goals

While developing DropNova, the primary focus was to keep the user experience as simple as possible.

The application was designed with the following goals:

  • No login required
  • No account creation
  • No phone number sharing
  • No cloud uploads
  • No software installation
  • Fast device pairing
  • Cross-platform compatibility
  • Minimal user interaction
  • Secure peer-to-peer communication

The objective was to make transferring files between laptops and phones as quick as scanning a QR code or entering a six-digit pairing code.


πŸ”’ Security

Although DropNova is designed to be simple to use, privacy and security were important considerations throughout development.

Peer-to-Peer Communication

Once a WebRTC connection is established, files are transferred directly between the sender and receiver.

The backend does not relay file data.


No Server Storage

Files are never uploaded, stored, or cached on the backend server.

The FastAPI server is responsible only for exchanging signaling information required to establish the WebRTC connection.


Temporary Sessions

Each transfer creates a temporary room for exactly two participants:

  • One Sender
  • One Receiver

After the transfer is complete or either user disconnects, the room is automatically cleaned up.


User Confirmation

Before any transfer begins, the receiver must explicitly accept the incoming files.

This prevents unwanted or accidental file transfers.


Automatic Cleanup

Temporary objects and browser resources are released after every transfer to reduce memory usage and avoid unnecessary storage consumption.


⚑ Performance

DropNova is designed to provide a fast and responsive file sharing experience.

Some performance-focused design decisions include:

  • Direct browser-to-browser communication
  • Chunk-based file transfer
  • No backend file relay
  • Minimal server bandwidth usage
  • Low latency after connection establishment
  • Multi-file transfer support
  • Automatic resource cleanup
  • Responsive interface for desktop and mobile browsers

Since file data does not pass through the backend, transfer speeds primarily depend on:

  • Internet connection quality
  • Device performance
  • Browser capabilities
  • WebRTC connection quality

⚠️ Known Limitations

Like any project, DropNova has some current limitations.

Render Free Tier

The deployed backend uses Render's free tier.

If the backend has been idle, the first connection may take a few seconds while the service wakes up.


No TURN Server

DropNova currently relies on STUN servers for NAT traversal.

In some restrictive corporate networks or strict NAT environments, establishing a direct peer-to-peer connection may not be possible.

Adding a TURN server would improve compatibility.


Browser Support

Some browser APIs used by DropNova are not supported equally across all browsers.

When available, the application uses the Native File System Access API.

Otherwise, compatible browsers fall back to OPFS.


Two Participants Per Session

Each session supports exactly:

  • One Sender
  • One Receiver

Multi-user file sharing is not currently supported.


Browser Limitations

Very large files may be limited by:

  • Browser memory
  • Mobile device resources
  • Browser implementation differences

Performance may vary depending on the user's device.


πŸš€ Future Improvements

Several improvements are planned for future versions of DropNova.

  • TURN server integration for improved connectivity
  • Pause and Resume controls
  • Drag-and-drop file uploads
  • Folder transfer support
  • Clipboard sharing
  • Transfer history
  • Transfer speed analytics
  • End-to-end encryption enhancements
  • Progressive Web App (PWA)
  • Native desktop application
  • Native Android application
  • Improved accessibility
  • Multi-language support
  • Unit testing
  • Integration testing
  • GitHub Actions CI/CD pipeline
  • Custom STUN/TURN server configuration
  • Device discovery on local networks
  • File integrity verification using checksums

πŸ“š Lessons Learned

Building DropNova provided valuable experience with modern web technologies and real-world software engineering concepts.

Some of the key areas explored during development include:

  • WebRTC peer-to-peer communication
  • FastAPI backend development
  • WebSocket-based signaling
  • Browser File System APIs
  • Chunk-based file transfer
  • State management
  • Session lifecycle management
  • Responsive UI development
  • Cross-device compatibility
  • Deployment using Netlify and Render
  • Debugging real-time networking issues
  • Working with asynchronous JavaScript
  • Building modular and maintainable project structures

This project significantly strengthened my understanding of full-stack web development and real-time communication systems.


🀝 Contributing

Contributions, suggestions, and feedback are always welcome.

If you'd like to improve DropNova:

  1. Fork the repository.
  2. Create a new feature branch.
  3. Commit your changes.
  4. Push the branch.
  5. Open a Pull Request.

πŸ™ Acknowledgements

This project was made possible thanks to several amazing open-source technologies.

Special thanks to:

  • WebRTC
  • FastAPI
  • Starlette
  • Tailwind CSS
  • QRCode.js
  • Netlify
  • Render
  • GitHub

Their excellent tools and documentation made the development of this project significantly easier.


πŸ“„ License

This project is licensed under the MIT License.

See the LICENSE file for more information.


⭐ If you found this project useful, consider giving it a star!

Thank you for visiting the repository.

Built with ❀️ using WebRTC, FastAPI and JavaScript.

About

Real-Time Peer-to-Peer File Transfer System using WebRTC, FastAPI and WebSockets

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages