This folder contains comprehensive documentation about running Hyperswarm/HyperDHT in React Native using Bare Kit.
1. WHY_HYPERDHT_NOT_IN_REACT_NATIVE.md (13 KB)
The Problem
Explains why Hyperswarm/HyperDHT doesn't work in standard React Native:
- UDP socket requirements
- Mobile platform limitations
- Architectural constraints
- Available networking APIs comparison
Read this first to understand the technical challenge.
2. BARE_KIT_SUMMARY.md (3 KB)
Quick Reference
A concise TL;DR of the Bare Kit solution:
- How it works (in brief)
- Key differences table
- Implementation steps overview
- Quick comparison with alternatives
Read this for a fast overview before diving deeper.
3. BARE_KIT_SOLUTION.md (22 KB)
The Solution (Detailed)
Complete architectural explanation of how Bare Kit enables Hyperswarm in React Native:
- Bare Kit architecture deep dive
- How bitcoin-tribe implements it
- Worklet runtime vs React Native runtime
- IPC/RPC communication patterns
- Code examples and diagrams
- Advantages and trade-offs
- Comparison with other solutions
Read this to fully understand the solution architecture.
4. IMPLEMENTATION_GUIDE.md (25 KB) ⭐⭐
Production-Ready Implementation Guide
Complete implementation guide with clean, maintainable code:
- Proper file structure and naming
- Full TypeScript type safety
- Clean state management patterns
- Type-safe RPC commands with enums
- Step-by-step instructions
- Complete code examples (ready to use)
- Build, test, and troubleshooting guides
- Performance optimization tips
- Better error handling
- Comparison with bitcoin-tribe approach
Follow this when you're ready to implement with production-quality code.
- Start with BARE_KIT_SUMMARY.md (quick overview)
- Read WHY_HYPERDHT_NOT_IN_REACT_NATIVE.md (understand the problem)
- Study BARE_KIT_SOLUTION.md (learn the solution)
- Follow IMPLEMENTATION_GUIDE.md (implement with production code)
- Skim BARE_KIT_SUMMARY.md (quick context)
- Jump to IMPLEMENTATION_GUIDE.md (start coding with clean examples)
- Reference BARE_KIT_SOLUTION.md (when you need architectural details)
- Read WHY_HYPERDHT_NOT_IN_REACT_NATIVE.md (the problem)
- Study BARE_KIT_SOLUTION.md thoroughly (the solution)
- Follow IMPLEMENTATION_GUIDE.md (implement with best practices)
- Review bitcoin-tribe source code (compare approaches)
React Native doesn't provide UDP socket access, which is required by HyperDHT for peer discovery and NAT traversal.
Bare Kit provides a native runtime (worklet) that runs alongside React Native with full Node.js compatibility, including UDP socket access.
┌────────────────────┐
│ React Native │ ← Your UI/UX layer
│ (Hermes/JSC) │
└─────────┬──────────┘
│
│ IPC/RPC (bare-rpc)
│
┌─────────▼──────────┐
│ Bare Worklet │ ← Hyperswarm runs here
│ (Native Runtime) │ ← Has UDP access!
│ ✅ Node.js APIs │
│ ✅ UDP Sockets │
│ ✅ Hyperswarm │
└────────────────────┘
- ✅ Pros: True P2P, no backend needed, full Hyperswarm functionality
⚠️ Cons: Larger bundle (~238 MB), more complexity, newer technology
- Main docs: ../DOCUMENTATION_INDEX.md
- Bitcoin-tribe reference: src/services/p2p/
- Bare Kit official: github.com/holepunchto/bare-kit
Current Status: Documentation complete, ready for implementation
Next Steps:
- Review all documents in this folder
- Install dependencies (see IMPLEMENTATION_GUIDE_BARE_KIT.md)
- Create worklet and manager files
- Test on iOS and Android
Want to get started right now?
# 1. Read the quick summary
open BARE_KIT_SUMMARY.md
# 2. Follow the production-ready implementation guide
open IMPLEMENTATION_GUIDE.md
# 3. Install dependencies
yarn add react-native-bare-kit@0.5.6 bare-rpc@0.2.5 hyperswarm@4.11.7 b4a@1.6.7 buffer@6.0.3| Document | Size | Type | Audience |
|---|---|---|---|
| WHY_HYPERDHT_NOT_IN_REACT_NATIVE.md | 13 KB | Analysis | Everyone |
| BARE_KIT_SUMMARY.md | 3 KB | Reference | Quick learners |
| BARE_KIT_SOLUTION.md | 22 KB | Technical | Architects |
| IMPLEMENTATION_GUIDE.md ⭐⭐ | 25 KB | Implementation | Developers |
| Total | 63 KB | Suite | All roles |
After reading these documents, you'll understand:
✅ Why Hyperswarm doesn't work in standard React Native
✅ How Bare Kit provides a native runtime solution
✅ The architecture of dual-runtime React Native apps
✅ How to implement IPC/RPC communication
✅ Step-by-step implementation process
✅ Trade-offs and when to use this approach
- Bare Kit GitHub
- react-native-bare-kit NPM
- Hyperswarm Docs
- Bitcoin-tribe P2P Implementation
- Holepunch Discord
This documentation was created on October 6, 2025, based on analysis of the bitcoin-tribe project's successful implementation of Hyperswarm in React Native using Bare Kit.