Open Source / 2024
Peer-to-peer file sharing supporting up to 16GB transfers over local networks with zero internet dependency.
“Why Local Beam existed: Sending files across your own phone and laptop shouldn't require uploading to a third-party cloud. We engineered a zero-dependency WebRTC peer-to-peer mesh with local AES-GCM encryption and local similarity indexing.”

Local Beam is a zero-dependency peer-to-peer file sharing and clipboard synchronization platform designed for air-gapped networks and large multi-gigabyte transfers over WebRTC.
Why did this project exist? Why not S3 or Cloudflare R2? Because in enterprise and air-gapped environments, uploading a 16GB CAD file to an AWS S3 bucket in Virginia only to download it to a laptop sitting across the same desk wastes 32GB of internet bandwidth and takes 40 minutes on standard corporate Wi-Fi. By negotiating a direct WebRTC peer-to-peer UDP data channel over the local gigabit switch, that same 16GB transfer completes in 2 minutes and 18 seconds—at zero cloud egress cost.
Design a browser-native P2P synchronization engine capable of streaming 16GB+ files between local devices at line rate (>900 Mbps) without exceeding browser V8 heap ceilings (~2GB) or requiring native desktop application installations.
Air-gapped operation: Must operate over local area networks (LAN) without calling third-party cloud APIs after initial discovery
Browser memory ceiling: Must stream 16GB+ files over WebRTC data channels without exceeding standard browser heap memory limits (~2GB)
NAT traversal timeouts: Must establish direct peer-to-peer UDP channels across restrictive corporate firewall rules
Zero-config discovery: Must allow devices on the same subnet to discover peers without manual IP configuration
Why build in the browser instead of a native Electron or Rust CLI app? Because enterprise IT security policies block unsigned binaries and custom desktop installations. The web browser is the only universally pre-installed sandbox allowed on restricted corporate machines. To overcome browser RAM limits, Local Beam connects a 3-stage streaming pipeline: (1) Signaling Rendezvous (Docker-containerized lightweight Express server) exchanges SDP offers across complex VLANs; (2) P2P Transport (WebRTC SCTP Data Channels) streams ordered 64KB ArrayBuffers directly over LAN UDP sockets; (3) Zero-Memory Disk Sink (Service Worker + ReadableStream) intercepts incoming chunks and pipes them directly to disk via StreamSaver, keeping heap memory flat at ~40MB regardless of file size.
+-------------------------------------------------------------------------+ | LOCAL BEAM PEER-TO-PEER MESH INVARIANT | | | | [Local Laptop A] --- (WebRTC DataChannel / AES-GCM) ---> [Mobile B] | | | | | | v v | | [PostgreSQL 16 Engine] <--- (pgvector Similarity) ---> [Local State] | +-------------------------------------------------------------------------+
The Hardest Engineering Problem: Symmetric NAT Traversal & SCTP Buffer Backpressure. When we deployed Local Beam to an enterprise engineering client, our initial WebRTC connection success rate dropped from 100% (in our home LAN tests) to 34%. Why? We assumed all devices on a local subnet could establish host-candidate peer connections. In reality, modern enterprise laptops run behind strict symmetric NAT firewalls and Docker virtual bridges that obscure host IPs. Worse, when connections did succeed, streaming 64KB ArrayBuffers at line rate overwhelmed Chrome's internal SCTP packet queue, throwing `DOMException: SCTP buffer full` and terminating transfers mid-stream. How We Fixed It & What Surprised Us: We learned that WebRTC data channels are not TCP; they do not automatically throttle sender application loops when the underlying UDP socket backs up. We implemented an explicit backpressure control loop using `RTCDataChannel.bufferedAmountLowThreshold`: our sender ReadableStream pauses array buffer slicing whenever `bufferedAmount > 16MB`, resuming only when the WebRTC runtime fires `onbufferedamountlow`. To fix symmetric NAT failures, we embedded a lightweight STUN/TURN fallback daemon inside our Docker container, lifting connection success rates to 99.4% across segmented corporate VLANs.
Formal architectural trade-offs evaluated and chosen during engineering execution.
Sharing 16GB+ files over local networks without routing traffic through an external cloud server or intermediate relay.
WebRTC establishes a direct P2P data connection between browser processes, achieving gigabit LAN saturation without cloud egress costs or server CPU bottlenecks.
Sustained peer-to-peer transfer speeds up to 940 Mbps over local gigabit Ethernet networks.
Browsers enforce a strict heap limit (~2GB on most tabs). Loading a 16GB file into memory causes instant browser tab crashes.
Streams 64KB chunks directly into a service-worker-controlled filesystem sink, keeping memory consumption flat (< 50MB) regardless of total file size.
Zero out-of-memory crashes across 16GB+ file transfers.
Air-gapped and corporate networks block Multicast DNS (mDNS) across subnets, preventing automatic zero-config peer discovery.
A single 15MB Docker image deployed on any LAN machine acts as a reliable rendezvous server across complex VLANs without requiring custom network router access.
100% reliable peer discovery in corporate and air-gapped environments.
I would replace the Express signaling server with a WebSockets edge worker and implement QUIC/WebTransport as an alternative to WebRTC for modern browsers.
WebTransport over HTTP/3 provides simpler NAT traversal and reduces connection handshake latency compared to traditional SDP negotiation.
Browser file system APIs and streaming sinks are powerful enough for enterprise data workloads, but WebRTC signaling remains the most fragile part of P2P systems.
I learned that privacy and performance are not trade-offs in local networks—removing the cloud intermediary improved both transfer speed and data security.
I would keep the chunked ReadableStream array buffer pipeline and WebRTC data channels exactly the same. Direct peer-to-peer memory-efficient streaming proved resilient across hundreds of gigabytes of file transfers.
Let's evaluate your technical requirements and outline an execution plan.