What inspired us
- Privacy-first sharing: We were tired of handing files to third-party servers. We wanted a truly private experience with zero relay, zero storage, and end-to-end encryption.
- Real multi-recipient needs: In meetings, classes, and communities, you often need to send to many people at once. Traditional tools are slow or restricted. We aimed for "send once, everyone receives concurrently"—with no practical size limit.
- Engineering curiosity: With WebRTC DataChannel and modern browser file APIs, peer-to-peer can be fast and reliable. We set out to push the browser-to-browser boundary: high throughput, resumable transfers, and multi-recipient broadcasting.
How we built it
- Architecture & stack
- Frontend: Next.js 14 (App Router), React 18, TypeScript, Tailwind, shadcn/ui.
- Realtime: WebRTC RTCDataChannel; Socket.IO for signaling; optional STUN/TURN for NAT traversal.
- Backend principle: signaling and room coordination only—no file relay or storage (privacy is a hard rule).
- Multi-recipient broadcasting
- One sender maintains multiple P2P connections and tracks per-peer progress and throughput. When a new recipient joins, the current content list is broadcast automatically.
- Scheduling uses chunk queues, backpressure, and per-peer round-robin/weighted sending to prevent a single slow link from dragging down the whole group.
- Practically unlimited file size
- With the File System Access API (directory permission + streaming-to-disk), very large files can be saved directly to disk—bounded by available storage and browser constraints.
- Resume support: after interruptions, rejoin the room and reload to resume from unfinished chunks (the same save directory permission is required).
- Key engineering details
- Chunking/backpressure/retry: small chunk queues with DataChannel
bufferedAmountthresholds; when congested, we yield and use exponential backoff for retries. - Connection recovery: using the
initiator-online/recipient-readysequence for robust re-negotiation after short outages or backgrounding. - Frontend steady state: a singleton
webrtcServiceplus a global Zustand store ensures ongoing transfers survive route transitions within the Next.js App Router.
- Chunking/backpressure/retry: small chunk queues with DataChannel
- A simple throughput and scheduling approximation (with LaTeX)
- Let chunk size be
cbytes, recipientsk, effective upstream bandwidthB_{up}, and send interval\Delta t. The total send rate is approximately [ R_{out} \approx \frac{k \cdot c}{\Delta t} ] To avoid congestion, [ R_{out} \le B_{up} \;\Rightarrow\; \Delta t \ge \frac{k\cdot c}{B_{up}} ] Under fair scheduling, per-recipient steady-state throughput is roughly [ T_i \approx \frac{B_{up}}{k}\,(1-\epsilon) ] where\epsilondenotes protocol and scheduling overhead. We adapt\Delta tand queue watermarks to balance fairness and aggregate throughput.
- Let chunk size be
What we learned
- Browsers can do serious transfers: with the right chunking and backpressure, DataChannel remains stable for long-haul, large-file scenarios.
- Permissions shape UX: directory access is the key to "unlimited size"—clear onboarding and revocation paths are essential.
- Fairness at scale: weighted round-robin and "slow-link isolation" significantly improve multi-recipient broadcasting.
- "Equivalent success signals": in tricky networks, treating
recipient-ready/offeras early success signals reduces false timeouts and perceived stalls. - Realtime + App Router: a singleton service and a single source of truth (Zustand) keep transfers smooth across route transitions.
The challenges we faced
- NAT traversal and flakiness: different environments rely on STUN/TURN to varying degrees. Stronger reconnection and candidate-queue handling reduced failures.
- Memory pressure with large files: stream reads/writes and per-chunk integrity checks keep memory peaks in control.
- Congestion control at
krecipients: aggregate upstream demand scales quickly. We adapt chunk size, pacing, andbufferedAmountLowThresholdto smooth bursts. - User clarity and permissions: we must communicate that "unlimited size" is bounded by disk and browser limits, with clear status and fallback paths.
- Experience consistency: mobile, power-saving, and background tabs can hurt stability. Wake lock and state recovery mitigate the impact.
PrivyDrop is our take on truly end-to-end, multi-recipient P2P file and text sharing—with stable transfers for practically unlimited file sizes, and a strict no-relay/no-storage architecture. Privacy and speed can co-exist, and everyone should be able to share without handing data to intermediaries.
Built With
- nextjs
- node.js
- typescript