A lightweight, privacy-focused web app for instant, ephemeral P2P file sharing using magnet links. Share audio, videos, images, or any files peer-to-peer without uploading to servers—links auto-expire in 1 minute for zero traces. Built with Node.js, Express, and WebSockets for real-time magic.
Why MagnetDrop? In a world of bloated cloud services, MagnetDrop keeps it simple: Select files client-side, generate a torrent magnet, share a short URL, and let P2P do the rest. Perfect for quick, secure drops like a video clip in a chat or a photo album that vanishes fast.
- Client-Side Magnet Generation: Choose files (audio, video, images, etc.)—no server uploads; bundles multiples into one magnet.
- Ultra-Ephemeral Links: Short URLs expire in 60 seconds—in-memory storage means no logs or persistence.
- Real-Time Sharing: WebSockets for instant responses—no page reloads.
- Smart Validation & Safety: Regex checks magnets; rate-limited (10/min) to prevent spam.
- P2P-Ready: Recipients get the full magnet for direct torrent streaming in apps like qBittorrent or uTorrent.
- Media-Optimized: Handles audio/video/images seamlessly; unlimited size via torrents.
- Self-Hostable: Runs locally or on free platforms like Render.
Pro Tip: For playlists or folders, select multiple files—they bundle into a single share.
MagnetDrop is a "spark" for P2P torrents: It generates and shortens magnet links client-side, then serves them temporarily via a Node.js server. The real transfer? Pure peer-to-peer—no central storage.
- Setup & Connect: Open
index.htmlin your browser—it auto-connects to the WebSocket server (ws://localhost:3000). - Select Files: Use the "Choose Files" button to pick media (e.g., MP4 video, MP3 audio, JPG images). The frontend (via libraries like WebTorrent) creates a magnet link locally—no data leaves your device.
- Share Instantly: Click "Share"—WebSocket sends the magnet to the server for validation.
- Get Short Link: Server generates a random 6-char ID (e.g.,
/share/a1b2c3), stores it in a Map with 1-min expiry, and replies with the URL. - Distribute: Copy the short URL and send it (e.g., via chat). It works locally or deployed.
- Recipient Retrieves: They visit the URL—server redirects to
/?magnet=...(encoded), auto-opening the magnet in their torrent client for P2P download/stream. - Auto-Cleanup: After 1 minute, the link 404s ("File not found or expired"). No traces—restart the server, and it's all gone.
- Backend: Node.js + Express (HTTP),
ws(WebSockets),crypto(ID gen),express-rate-limit(safety). - Frontend: Static HTML/JS with file input; inferred WebTorrent for magnet creation (add via CDN for full support).
- Storage: In-memory
Map—ephemeral by design. - Ports: Defaults to 3000; env var
PORTfor deployment.
Behind the Scenes Diagram (Text-Based):
[User Browser] --WebSocket--> [Node Server (Map: ID -> {magnet, expiry})]
| |
v v
[File Select] -> [Generate Magnet] -> [Validate & Shorten] -> [Short URL]
| |
v v
[Copy/Share] [Visit -> Redirect to Magnet -> P2P in Torrent App]
| |
└─────────────── 1-min Timeout ───────────────┘ └────────────── Seeder Online ───────────────┘
- Prerequisites: Node.js (v18+).
- Clone/Setup:
clone the repo cd magnetdrop npm init -y npm install express ws crypto express-rate-limit - Run:
node server.js- Server starts on
http://localhost:3000. - Open in browser: Loads
public/index.html.
- Server starts on
- Deploy: Push to Render/Vercel—set
PORTenv. Uncomment production URL inserver.js.
Note: Add WebTorrent CDN to index.html for client-side magnet gen:
<script src="https://cdn.jsdelivr.net/npm/webtorrent@latest/webtorrent.min.js"></script>- Sharing: Load page → Choose files → Share → Copy URL.
- Receiving: Paste URL → Auto-redirects to magnet → Open in torrent client.
- Customization: Edit
LINK_EXPIRY_TIMEinserver.jsfor longer expiry.
Edge Cases:
- Invalid magnet? Error via WebSocket.
- Expired? 404 page.
- Offline? Fallback to HTTP for retrieval.
MagnetDrop's niche: Magnet-based, 1-min ephemeral P2P—beats others for traceless media shares. Quick 2025 snapshot:
| Feature | MagnetDrop | FilePizza | Send Anywhere | ShareDrop | ToffeeShare | Wormhole |
|---|---|---|---|---|---|---|
| P2P Method | Torrent magnets (client) | WebRTC torrents | Key-based P2P/relay | WebRTC local | E2E encrypted P2P | E2E links (P2P optional) |
| Expiry | 1 min (ultra-short) | None (manual) | Up to 48 hrs | One-time | Custom/password | 1 day (self-destruct) |
| File Size | Unlimited | Unlimited | Unlimited | Unlimited (network) | Unlimited | 10 GB free |
| Privacy | In-memory; no logs | Direct P2P; encrypted | Encrypted access | Encrypted | E2E; no server | Zero-knowledge |
| Upload? | No (client-only) | No | No (P2P) | No | No | No |
| Pricing | Free (open-source) | Free | Free/Pro $5.99/mo | Free | Free | Free/Teams $10/mo |
| Best For | Quick torrent media | Browser torrents | Cross-device | Local drops | Password temp files | Secure one-offs |
Insights: MagnetDrop wins on privacy speed (faster than FilePizza's handshakes). Use Send Anywhere for global reliability; ToffeeShare for flexible expiry.
- Supports audio/video/images? Yes—client-side magnet bundles them for P2P streaming.
- Why 1-min expiry? For max privacy; tweak
LINK_EXPIRY_TIMEfor more. - Big files? Unlimited—torrents handle it; you seed while they download.
- Secure? Random IDs, validation, no storage—but magnets are public, so share wisely.
- Link expires mid-download? Short URL dies, but full magnet persists via P2P if you're seeding.
- Run it? See Installation; needs torrent client for receiving.
Why Choose It? Zero-overhead P2P "burner links"—fast, free, and forgettable. Tired of upload waits? This is your spark.
Fork, tweak, PR! Issues welcome.
Built with ❤️ for you. Questions? Open an issue or hit the GitHub star! 🌟
