Skip to content

dhakadlabs/FileSpread

Repository files navigation

FileSpread

FileSpread is a browser-first peer-to-peer file sharing web app. It enables direct device-to-device file, link, and text transfer using WebRTC, without sending shared content through a cloud storage service.

What is FileSpread?

FileSpread is designed for fast, private local sharing across devices on the same network or grid. It uses a lightweight signaling server only for discovery and WebRTC connection setup. After peers connect, file and message traffic flows directly between browsers.

Key Features

  • Peer discovery via WebSocket signaling
  • Direct peer-to-peer WebRTC data channels
  • Send text messages, links, and files
  • Chunked file transfer with backpressure handling
  • Local message and pinned device storage using IndexedDB
  • QR code scanning and sharing for quick pairing
  • Clean single-page app experience with a modern UI

Architecture

The project is split into two parts:

  • FileSpread/ — React + TypeScript frontend application
  • FileSpread-signaling/ — lightweight Node.js signaling server using WebSocket

Frontend

  • App.tsx — main application UI and state management
  • DiscoveryService.ts — signaling client for peer discovery and message forwarding
  • webrtcService.ts — WebRTC peer connection and file/data transfer logic
  • db.ts — IndexedDB wrapper for local persistence
  • types.ts — shared TypeScript model definitions
  • components/Icons.tsx — custom SVG icon components

Signaling Server

  • FileSpread-signaling/index.js — a minimal WebSocket server that tracks peers by grid and forwards pairing and ICE signaling messages.

How it works

  1. Each browser instance joins a shared grid via the signaling server.
  2. The server broadcasts the list of available peers in the same grid.
  3. When a user connects to another peer, the app exchanges WebRTC offers, answers, and ICE candidates through the signaling server.
  4. Once the WebRTC data channel is established, peers send text, link, and file packets directly.
  5. File transfers are sent in chunks with flow control to avoid browser memory issues.

Run locally

Frontend

  1. Open a terminal in FileSpread/FileSpread
  2. Install dependencies:
    npm install
  3. Start the app:
    npm run dev
  4. Open the local Vite URL shown in the terminal.

Signaling server

  1. Open a terminal in FileSpread/FileSpread-signaling
  2. Install dependencies:
    npm install
  3. Start the server:
    node index.js
  4. The server listens on port 8080 by default.

Customization

  • Update the signaling URL in DiscoveryService.ts if you want to run your own server.
  • The grid ID is derived from window.location.pathname, so peers on the same path join the same discovery grid.

Notes

  • The signaling server does not store files or chat content.
  • File transfer happens directly between peers using browser WebRTC.
  • The app stores pinned devices and message history locally in the browser.

License

Use and modify the project as needed for local sharing experiments and browser-based P2P prototypes.

Please Request a feature in REQUEST.md file.

  • Support us if u find it valuable

About

FileSpread is a browser-based, peer-to-peer file sharing web application that enables fast, private, local transfers between nearby devices — with no cloud, no servers, and no installation required. Built for cross-platform use and everyday workflows.

Topics

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

No releases published

Sponsor this project

Packages

 
 
 

Contributors