A modern, peer-to-peer file sharing application built with Next.js, WebRTC, and Socket.IO. Share files directly between devices without uploading to any server - your files never leave your local network!
- π Direct P2P Transfer: Files are shared directly between devices using WebRTC
- π Local Network Support: Works across your local network (WiFi/LAN)
- π± Multi-Device: Share between phones, tablets, laptops, and desktops
- π Real-time Progress: Live transfer progress and speed monitoring
- π― Room-based Sharing: Create rooms and share files with multiple peers
- πΎ Chunked Transfer: Large files are split into chunks for reliable transfer
- π Secure: No files are stored on external servers
- β‘ Fast: Direct device-to-device communication for maximum speed
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
β Device A β β Signaling β β Device B β
β (Host) βββββΊβ Server βββββΊβ (Peer) β
β β β (Socket.IO) β β β
β Next.js App β β Port 3001 β β Next.js App β
β Port 3000 β β β β Port 3000 β
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
β β β
βββββββββββββββββββββββββΌββββββββββββββββββββββββ
β
WebRTC Direct Connection
(Files transfer directly)
- Node.js 18+ - Download here
- Modern Browser - Chrome, Firefox, Safari, or Edge
- Local Network - All devices must be on the same WiFi/LAN
-
Clone the repository
git clone https://github.com/souravrane/hikari-beam.git cd hikari-beam -
Start the application
chmod +x start.sh ./start.sh
-
Open in browser
- Go to
http://localhost:3000 - Or use your local IP:
http://YOUR_IP:3000
- Go to
If you prefer to run the services separately:
-
Install dependencies and start the signaling server
# Install backend dependencies npm install # Start signaling server npm start
-
Start the frontend (in a new terminal)
cd p2p-share npm install npm run dev
- Open the app in your browser
- Click "Create New Room" to generate a room ID
- Select a file to share using the file picker
- Share the room URL with other devices
- Wait for peers to join and start the transfer
- Open the room URL in your browser
- Wait for the host to select a file
- Accept the file when prompted
- Watch the download progress in real-time
To share files across devices on your local network:
-
Find your local IP address:
# macOS/Linux ifconfig | grep "inet " | grep -v "127.0.0.1" # Windows ipconfig | findstr "IPv4"
-
Access from other devices:
- Use
http://YOUR_IP:3000instead ofhttp://localhost:3000 - All devices must be on the same WiFi network
- Use
- Check firewall settings - Ensure ports 3000 and 3001 are not blocked
- Verify network connectivity - All devices must be on the same network
- Try refreshing the page if connections fail
- Check browser console for any error messages
hikari-beam/
βββ package.json # Root package.json (backend config)
βββ signaling-server/ # Socket.IO signaling server
β βββ server.js # Express + Socket.IO server
β βββ package.json # Backend dependencies
βββ p2p-share/ # Next.js frontend application
β βββ app/ # Next.js app directory
β β βββ components/ # React components
β β βββ r/[roomId]/ # Dynamic room pages
β βββ lib/ # Core P2P logic
β β βββ webrtc.ts # WebRTC connection management
β β βββ signaling.ts # Socket.IO signaling
β β βββ file-transfer.ts # File transfer logic
β β βββ chunking.ts # File chunking utilities
β βββ package.json # Frontend dependencies
βββ start.sh # Development startup script
Backend (Root Directory)
npm install # Install backend dependencies
npm start # Start signaling server (production)
npm run dev # Start signaling server (development)
npm run build # Build frontend for productionFrontend (p2p-share)
cd p2p-share
npm install # Install frontend dependencies
npm run dev # Start development server
npm run build # Build for production
npm run start # Start production server
npm run lint # Run ESLint
npm run type-check # Run TypeScript type checkingCreate .env.local in the p2p-share directory:
# Optional: Custom signaling server URL
NEXT_PUBLIC_SIGNALING_SERVER=ws://localhost:3001The signaling server runs on port 3001 by default. You can configure it by setting environment variables:
HOST=0.0.0.0 # Bind to all interfaces
PORT=3001 # Server portThe server is configured to accept connections from:
http://localhost:3000http://127.0.0.1:3000- Any local network IP (192.168.x.x, 10.x.x.x, 172.16-31.x.x)
GET /health- Health check endpointGET /stats- Server statistics and room information
Client to Server:
join- Join a roomleave- Leave a roomsignal- Send WebRTC signaling datafile-status- Update file sharing status
Server to Client:
joined- Confirmation of room joinpeer-joined- New peer joined the roompeer-left- Peer left the roomsignal- WebRTC signaling data from another peer
-
Build the frontend:
cd p2p-share npm run build -
Start production servers:
# Start signaling server cd signaling-server npm start # Start frontend (in another terminal) cd p2p-share npm start
- Fork the repository
- Create a feature branch:
git checkout -b feature-name - Commit your changes:
git commit -am 'Add some feature' - Push to the branch:
git push origin feature-name - Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
- WebRTC for peer-to-peer communication
- Socket.IO for signaling server
- Next.js for the React framework
- Tailwind CSS for styling
- TypeScript for type safety
If you encounter any issues or have questions:
- Check the Issues page
- Create a new issue with detailed information
Happy File Sharing! π
Built with β€οΈ using modern web technologies