Simple P2P file sharing and persistence server using WebTorrent
https://share.vski.ai/
- TypeScript 97.9%
- Dockerfile 2%
|
|
||
|---|---|---|
| .forgejo/workflows | ||
| .zed | ||
| __test__ | ||
| server@d3a9d9250b | ||
| web@55a98d1df8 | ||
| web_tracker | ||
| .gitignore | ||
| .npmrc | ||
| AGENTS.md | ||
| docker-compose.yml | ||
| Dockerfile | ||
| README.md | ||
| test.dockerfile | ||
ViShare
Peer-to-peer file sharing via WebTorrent magnet links. Share files directly between browsers without uploading to a server.
Features
- P2P File Sharing: Files are shared directly between peers using WebTorrent
- QR Code Sharing: Generate QR codes for easy mobile sharing
- QR Scanner: Scan QR codes to download shared files
- Multiple Files: Share multiple files in a single torrent
- Persistent Downloads: Downloads persist across page reloads
- Mobile-Friendly: Responsive UI optimized for mobile devices
- Optional Server: Magnet server can persist shares for offline availability
- DeltaChat/Telegram Bot: Bot interface for sharing via messaging apps
Architecture
vishare/
├── tracker/ # wt-tracker - WebSocket tracker for peer discovery
├── server/ # Node.js server - persists torrents, HTTP/HTTPS API
├── web/ # React/Vite web app - file sharing UI
└── src/ # Deno bot - DeltaChat/Telegram integration
Quick Start
1. Start the Tracker
cd tracker
npm install
npm run build
npm run start:dev
Tracker runs on:
- HTTP:
ws://localhost:8000 - HTTPS:
wss://localhost:8443
2. Start the Server (optional)
cd server
pnpm install
pnpm run dev
Server runs on:
- HTTP:
http://localhost:3100 - HTTPS:
https://localhost:3443
3. Start the Web App
cd web
pnpm install
pnpm run dev
Web app runs on https://localhost:5173 (HTTPS required for camera access)
Usage
Sharing Files
- Open the web app
- Drag & drop files or tap to select
- Click "Share" to create a magnet link
- Share via "Show QR" or "Copy Link"
Downloading Files
- Go to the Download tab
- Paste a magnet link or scan a QR code
- Wait for download to complete
- Click the file to save
Configuration
In Settings, you can:
- Add/remove tracker URLs
- Add/remove magnet servers
- Select active server for persistence
Development
Prerequisites
- Node.js 18+ (for server and tracker)
- pnpm (for server and web)
- Deno (for bot)
Commands
# Tracker
cd tracker && npm run dev
# Server
cd server && pnpm run dev
# Web app
cd web && pnpm run dev
# Bot
deno task dev
Self-Signed Certificates
For development, self-signed certificates are in certs/:
cert.pem- Certificatekey.pem- Private key
Generate new ones:
openssl req -x509 -newkey rsa:4096 -keyout certs/key.pem -out certs/cert.pem -days 365 -nodes -subj "/CN=localhost"
Technical Details
Magnet Link Format
magnet:?xt=urn:btih:<infohash>&dn=<share_name>&tr=<tracker_url>
xt- Infohash (required)dn- Display name (human-readable share name)tr- Tracker URL
WebTorrent in Browser
WebTorrent is loaded via CDN (esm.sh) because it has Node.js dependencies that can't be bundled. The global WebTorrent is available after the script loads.
IndexedDB Persistence
- Shares with "sharing" status are persisted
- Downloads are persisted (files must be re-downloaded after reload)
- Blob URLs don't survive page reloads
License
MIT