Zero-config peer-to-peer file sharing & messaging β no servers, no limits.
π Live Demo Β· Report Bug Β· Request Feature
LocalShare is a fully client-side, peer-to-peer file-sharing and messaging web application built with vanilla HTML, Tailwind CSS v4, and JavaScript. It leverages WebRTC via PeerJS to enable devices on the same network to discover each other and transfer files directly β no intermediary server, no file size limits, no data leaves your network.
| Feature | Description |
|---|---|
| Direct P2P Transfers | Files stream device-to-device over encrypted WebRTC data channels |
| Zero-Config Discovery | Devices sharing a public IP auto-discover each other via room registry |
| Corruption-Free Transfers | FNV-1a checksum verification + ordered chunk assembly guarantees file integrity |
| High-Speed Chunking | 256KB chunks with WebRTC backpressure control for maximum throughput |
| Failover Room Host | Automatic host election with seamless failover if the host disconnects |
| Secure Handshakes | Explicit Accept/Reject confirmation before any connection is established |
| Real-Time Transfer Metrics | Live speed, percentage, and byte-count tracking with progress bars |
| Room Chat | Encrypted in-room messaging between all connected peers |
| Manual Peer Connect | Bridge any network via direct Peer ID or QR code scanning |
| Drag & Drop | Native drag-and-drop file selection with multi-file support |
| Smart File Icons | Automatic icon detection for 30+ file types (media, code, archives, apps) |
- Multi-Source Room Resolution: Multi-tier public IP lookup (ipify IPv4, icanhazip, api64) with timeouts, STUN candidate fallback, and local subnet normalization.
- Direct Room Link & QR Sharing: Open or share any custom room via URL hash (
#room=my-room) or scan a QR code to guarantee 100% discovery across separate Wi-Fi networks, cellular, or VPNs. - Resilient Room Host Election: Randomized jitter backoff eliminates collision storms during election; room host auto-reconnects on signaling drops.
- Distributed Peer Gossip: Connected peers exchange active rosters; discovery persists even during room host transitions.
- Real-Time Latency Tracking: Continuous RTT ping/pong metrics displayed on active connection cards.
- Cryptographic SAS Verification: Deterministic 4-digit verification code and emoji fingerprint derived from peer IDs (
SHA-256 / FNV-1a) to prevent man-in-the-middle attacks. - Transfer Consent (File Offers): Receivers review file offers (sender, file list, sizes) before accepting, preventing unauthorized memory flooding and spam.
- Auto-Accept & Trusted Devices: Configurable auto-accept toggle and remembered trusted device list for seamless home/office workflows.
- Transfer Cancellation: Senders and receivers can abort in-flight transfers anytime, immediately releasing memory buffers.
- Zero-Copy Memory Assembly: Direct
Blobconstruction from binary chunk arrays avoids duplicate buffer allocations and eliminates OOM crashes on large files. - Path Traversal & Execution Sanitization: File names sanitized against directory traversal (
../) and dangerous MIME types safely handled.
- Refined SaaS Design: Polished border radius, glowing cyber accents, subtle glassmorphic panels, and backdrop blurs.
- Custom Device Renaming: Inline nickname editor persists to
localStorageand syncs dynamically across linked peers. - Theme Accent Switcher: 6 cyber color palettes (Electric Cyan, Emerald Green, Neon Violet, Solar Amber, Rose Pink, Cyber Blue).
- In-App File Previewer: Instant inline preview for received images, text/code, and audio files.
- Web Audio Chimes: Synthesized audio feedback for connections, completed transfers, and messages (with mute toggle).
- Target Recipient Selection: Choose to broadcast to all connected devices or target a specific peer.
- Folder Support: Select and upload whole folders via directory input.
- Eliminated file corruption: Replaced naive
FileReaderchunking with directArrayBufferslicing, ordered chunk indices, and FNV-1a checksum verification on receive - 256KB chunk size (up from 64KB) for 4Γ faster transfers
- WebRTC backpressure: Monitors
dataChannel.bufferedAmountto prevent buffer overflow and data loss - MIME type preservation: Files are reconstructed with their original MIME type for proper handling by the OS
- Transfer-complete handshake: Receiver verifies chunk count and checksum before assembling the final Blob
- Removed artificial delays: Replaced
setTimeout(10ms)chunking withrequestAnimationFramefor smooth, non-blocking sends
- Single-target failover architecture: Devices probe one unified room host ID; on collision, they silently fall back to client mode
- Faster room resolution: Ipify lookup with 4s abort timeout and graceful local fallback
- Clean console: Suppressed all expected PeerJS warnings during normal discovery flow
- Reconnection handling: Automatic signaling server reconnect with visual status indicators
- Professional SaaS design: Clean card-based layout with Inter font, consistent spacing, and subtle glass effects
- Toast notification system: Replaced basic popup with animated, typed toast messages (info/success/error/warning)
- Drag-and-drop zone: Visual feedback with scale animation on drag-over
- File type icons: 30+ file extensions mapped to Bootstrap Icons
- Live transfer speed: Real-time MB/s display during sends and receives
- Status indicators: Network dot, device status, and connection count badges
- Responsive grid: 12-column layout that adapts from mobile to desktop
- Dark-mode optimized: Pure black (#000) AMOLED background with cyan/mint accents
- 48 adjectives Γ 48 nouns Γ 900 numbers Γ 16 emojis = 33M+ unique combinations
- Emoji prefix for instant visual identification in peer lists
π https://local-share.netlify.app/
# Clone the repository
git clone https://github.com/Infinitode/LocalShare.git
# Navigate into the project
cd LocalShare
# Compile Tailwind CSS v4 (requires Node.js)
npx @tailwindcss/cli -i input.css -o output.css --watch
# Open index.html in your browser or use a local server
npx serve .βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Room Discovery β
β β
β Device A βββ β
β Device B βββΌβββΊ Room Host (ls-roomhost-{room-id}) β
β Device C βββ β β
β βΌ β
β Registry Roster Broadcast β
β (peer list sync to all clients) β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β File Transfer β
β β
β Sender Receiver β
β ββββββ ββββββββ β
β 1. Read file as ArrayBuffer β
β 2. Compute FNV-1a checksum β
β 3. Send metadata (name, size, β
β chunks, mime, checksum) β
β 4. Stream 256KB chunks βββββββΊ Collect by index β
β (with backpressure) 5. Verify chunk count β
β 6. Verify checksum β
β 7. Assemble Blob β
β 8. Offer download β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
LocalShare queries ipify for your public IP, hashes it into a deterministic #room-id. All devices behind the same NAT share this room.
The first device binds to ls-roomhost-{room-id}. Subsequent devices detect the ID is taken and connect as clients. If the host drops, the next heartbeat triggers a new election.
Every file transfer includes:
- Chunk sequencing β each chunk carries its index
- FNV-1a checksum β computed over the full file before send, verified after assembly
- MIME type β preserved for correct Blob construction
- Completion signal β explicit
transfer-completemessage triggers final verification
- HTML5 β Semantic markup
- Tailwind CSS v4 β Utility-first styling (compiled via
@tailwindcss/cli) - Vanilla JavaScript (ES2022) β No frameworks, no build step for logic
- PeerJS β WebRTC abstraction for data channels
- QRCode.js β Instant QR code generation for peer IDs
- Bootstrap Icons β Icon system
Contributions make the open-source community an amazing place. Any contributions are greatly appreciated.
- 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
Or simply open an issue with bug reports or suggestions.
LocalShare is released under the MIT License (Modified). See LICENSE for details.
Modified Clause: Derivative works must be clearly distinguished from the original and distributed under a different name.
Made with β€οΈ by Infinitode
