How To
Goal-oriented recipes for building peer-to-peer logic on Bare—connecting peers, replicating data, streaming media, and running on native and mobile.
How-tos are goal-oriented recipes. Each one assumes you already know roughly what you're doing and just need the steps for a particular task—connecting two peers with HyperDHT, replicating with Hypercore, or porting an existing Node.js app.
If you want to look up an API or a module, that's Reference. For the conceptual "why," see About Bare.
Everything here is peer-to-peer logic that runs on Bare alone. If you're building or shipping a Pear app instead—staging, seeding, provisioning, updating—those guides are on the Pear tab.
Pear is the platform on top of Bare. Everything here runs on Bare on its own. Install the pear CLI when you also want peer-to-peer app distribution, over-the-air updates, and one command to stage and release—the core you write for Bare moves across unchanged. Start on the Pear tab, or read How Pear and Bare fit together.
In this section
- Migrate a Node.js app to Bare—port an existing Node.js app to run on Bare.
- Troubleshoot common issues—fixes for common Pear and Bare development issues.
Connecting peers
- Connect two peers by key with HyperDHT
- Connect to many peers by topic with Hyperswarm
- Host multiple rooms in one chat app
Storage and replication
- Replicate and persist with Hypercore
- Work with many Hypercores using Corestore
- Share append-only databases with Hyperbee
- Create a full peer-to-peer filesystem with Hyperdrive
- Store and serve large media with Hyperblobs
- Keep data available with blind peering
- Add blind peering to a chat app
Managing identity
Stream and share media
- Share files in a peer-to-peer app
- Back up photos in a peer-to-peer app
- Stream stored video in a peer-to-peer app
- Stream a live camera in a peer-to-peer app