Peerweb
Decentralized website hosting powered by WebTorrent
Install / Use
/learn @Omodaka9375/PeerwebREADME
🪐 PeerWeb 🪐
🌏 Decentralized website hosting powered by WebTorrent 🌏
PeerWeb enables truly decentralized, censorship-resistant website hosting through peer-to-peer networks. Upload your static websites and share them globally without relying on centralized servers or paying hosting fees.
<img width="1356" height="957" alt="image" src="https://github.com/user-attachments/assets/9b47f09d-e2ca-4b82-a936-ff8445d8a4fa" />Link demos
-
Main Page - https://peerweb.lol
-
Functionality Demo with local resources - https://peerweb.lol/?orc=90c020bd252639622a14895a0fad713b91e0130c
-
SomaFM on PeerWeb - https://peerweb.lol/?orc=908d19242ae1461f333a516d1f8b89c13ef2d259
-
Chess on PeerWeb - https://peerweb.lol/?orc=525bad84c4637cc49b47e3b9a5e3e9bd6a6dc398
-
Text Editor app on PeerWeb - https://peerweb.lol/?orc=4e5f1204dcec68195bfcc89f9410a0b70a0ddfac
-
Markdown Editor on PeerWeb - https://peerweb.lol/?orc=59587ae54c2cc2cf1b0419728ab5625fd7c54fdf
✨ Features
🚀 Core Features
- Drag & Drop Upload - Simply drag your website folder
- Instant Sharing - Get a shareable PeerWeb link immediately
- Zero Hosting Costs - No servers, no monthly fees, completely free
- Censorship Resistant - Distributed across peer-to-peer networks
- Always Available - Works as long as there are online peers
💾 Smart Technology
- Intelligent Caching - Lightning-fast loading with IndexedDB storage
- Service Worker Magic - Seamless resource loading and offline support
- Progress Tracking - Real-time download progress and peer statistics
- Auto Cleanup - Expired cache automatically cleaned after 7 days
🛡️ Security & Safety
- XSS Protection - All HTML sanitized with DOMPurify
- Hash Sanitization - Torrent hashes sanitized to prevent XSS attacks
- Sandboxed Execution - Sites run in isolated iframe environments
- Content Validation - All resources validated before display
- External Link Preservation - Social media and external links work normally
- Memory Leak Prevention - Automatic cleanup of timeouts and object URLs
🎯 User Experience
- Toast Notifications - Non-blocking, user-friendly notifications
- Quick Upload Interface - Prominent drag-and-drop area
- Advanced Torrent Creator - Full-featured torrent creation tools
- Debug Mode - Detailed logging for developers and troubleshooting
- PWA Support - Install as a Progressive Web App on any device
- Mobile Friendly - Responsive design works on all devices
🚀 Quick Start
1. Host a Website
- Open PeerWeb.lol in your browser
- Drag your website folder to the upload area
- Get your unique PeerWeb URL, and keep the tab open
- Share the link with anyone, anywhere!
2. Load a Website
- Enter a torrent hash in the load field
- Or use a PeerWeb URL:
https://peerweb.lol?orc=HASH - Website loads directly from the peer network
3. Debug & Develop
Add &debug=true to any PeerWeb URL for detailed logging:
https://peerweb.lol?orc=ABC123...&debug=true
📋 Website Requirements
Your websites should be:
- ✅ Static content only (HTML, CSS, JS, images, fonts, etc.)
- ✅ Include index.html (in root)
- ✅ Use relative paths for all internal resources
- ✅ Responsive design recommended for best experience
🏗️ Project Structure
peerweb/
├── index.html # Main application interface
├── peerweb.js # Core PeerWeb functionality
├── peerweb.min.js # Minified version
├── peerweb-sw.js # Service Worker for resource handling
├── manifest.json # PWA manifest for installable web app
└── README.md # This file
🌐 How It Works
The Magic Behind PeerWeb
-
Upload Process
- Your website files are packaged into a BitTorrent torrent
- A unique hash identifies your site across the network
- Files are seeded from your browser to the peer network
-
Loading Process
- Service Worker intercepts resource requests
- Files are downloaded via WebTorrent from multiple peers
- Content is cached locally for instant future access
-
Security Layer
- All HTML content sanitized with DOMPurify
- Torrent hashes sanitized to prevent XSS
- Sites run in sandboxed iframe
- External links preserved and functional
- Automatic memory cleanup on page unload
🚀 Advanced Usage
Debug Mode
Enable detailed logging by adding &debug=true to any URL:
// Example debug output
[PeerWeb:DEBUG] Loading site with hash: abc123...
[PeerWeb:INFO] Found 15 files in torrent
[PeerWeb:DEBUG] Processing site early (95% complete)
[PeerWeb SW] Serving file: styles.css (2.4KB)
Production vs Development
PeerWeb automatically detects the environment:
- Production (peerweb.lol): Only shows warnings and errors
- Development (localhost): Shows all debug information
Progressive Web App
Install PeerWeb on any device:
- Visit PeerWeb.lol
- Look for "Install" or "Add to Home Screen" in your browser
- Use PeerWeb like a native application
Features when installed:
- Standalone app window
- App icon on home screen/desktop
- Faster loading with caching
- Offline access to cached sites
🤝 Contributing
We welcome contributions! Here's how you can help:
🐛 Report Bugs
- Use the Issues tab
- Include browser version, steps to reproduce, and error messages
- Enable debug mode for detailed logs
💡 Suggest Features
- Open a Feature Request
- Describe the use case and expected behavior
- Check existing issues to avoid duplicates
🔧 Submit Code
- Fork the repository
- Create a feature branch:
git checkout -b feature-name - Make your changes and test thoroughly
- Submit a Pull Request with detailed description
📝 Improve Documentation
- Fix typos or unclear instructions
- Add examples and use cases
- Translate to other languages
📖 Documentation
Browser Support
- ✅ Chrome/Chromium 60+ (Recommended)
- ✅ Firefox 55+
- ✅ Safari 11+
- ✅ Edge 79+
- ❌ Internet Explorer (Not supported)
WebTorrent Compatibility
- Uses WebTorrent for browser-based torrenting
- Compatible with standard BitTorrent protocol
- Supports DHT, PEX, and WebRTC connections
Limitations
- Static sites only - No server-side processing
- Browser hosting - Sites available while browser tab is open
- Peer dependency - Requires active peers for availability
- Large files - May be slow for sites with many large assets
🔒 Security
Content Sanitization
Multi-layer XSS protection:
- HTML Sanitization - All HTML content sanitized with DOMPurify
- Hash Sanitization - Torrent hashes stripped of non-hex characters
- Script Injection Prevention - Malicious scripts blocked
- Dangerous Elements - Unsafe HTML elements and attributes removed
Sandboxed Execution
Websites run in sandboxed iframes with restrictions:
<iframe sandbox="allow-scripts allow-same-origin allow-forms allow-popups allow-modals"></iframe>
External Resource Handling
- External links (social media, email, etc.) work normally
- CDN resources and external stylesheets load properly
- Only internal site resources are processed through PeerWeb
🌟 Use Cases
📝 Personal Websites
- Portfolio sites
- Blogs and documentation
- Landing pages
- Resume/CV sites
🎨 Creative Projects
- Art galleries
- Photography portfolios
- Interactive demos
- Games and experiments
📚 Educational Content
- Course materials
- Tutorials and guides
- Research publications
- Student projects
🌍 Censorship Resistance
- News and journalism
- Political content
- Whistleblowing platforms
- Freedom of speech tools
🏆 Desktop Clients
For permanent hosting without keeping browser tabs open:
- 🪟 Windows - PeerWeb Desktop (Coming Soon)
- 🍎 macOS - PeerWeb Desktop (Coming Soon)
- 🐧 Linux - PeerWeb Desktop (Coming Soon)
📊 Technical Specifications
Supported File Types
- Documents: HTML, CSS, JavaScript, JSON, XML
- Images: PNG, JPEG, GIF, SVG, WebP, ICO
- Fonts: WOFF, WOFF2, TTF, OTF, EOT
- Media: MP4, WebM, MP3, WAV
- Other: PDF and various binary formats
Performance
- Caching: IndexedDB with 7-day expiration
- Loading: Progressive loading with 95% threshold
- Piece Size: Optimized based on total site size
- Timeout: 5-second request timeout with fallbacks
- Memory Management: Automatic cleanup of timeouts and object URLs
- Resource Tracking: All setTimeout calls tracked and cleaned up
Network
- Trackers: 7+ built-in BitTorrent trackers
- Protocols: WebRTC, WebSocket, HTTP fallback
- DHT: Distributed Hash Table support
- PEX: Peer Exchange for discovery
📄 License
This project is licensed under the MIT License - see the LICENSE file for details.
🙏 Acknowledgments
- WebTorrent - Browser-based BitTorrent implementation
- DOMPurify - XSS sanitizer for HTML
- BitTorrent Protocol - Peer-to-peer file sharing foundation
- Service Workers - Enabling offline-first web applications
📞 Support
Getting Help
- 📖 Documentation: Check this README and inline code comments
- 🐛 Bug Reports: Use GitHub Issues with debug logs
- 💬 Community: Join discussions in
Related Skills
node-connect
349.2kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
109.5kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
349.2kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
349.2kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
