Can someone explain PeerPouch to me?

52 views
Skip to first unread message

Glen Simister

unread,
Jun 16, 2016, 8:56:29 PM6/16/16
to PouchDB
Hi guys! 

I’m looking around for a simple peer-to-peer database and i would like to know if PouchDB is the way to go. I’ve looked into PeerPouch and it says it can allow you to “share a local database to remote peers”. So does this mean that each user can potentially run their own server, and replicate the data to each other in a peer-to-peer fashion? 

Secondly, it says “To set up a peer connection, you actually need to start with a centralized database”. Can someone please explain how this works? What would i need to do to setup a server to connect peers? 

What i want is for my users to serve this information. For example, on Facebook you can add friends. I want a similar system whereby users visit each others profiles, add them as a friend, retrieve and store a list of peers, and replicate data with those peers thus forming a network of semi-trusted peers. Can this be done easily with PeerPouch?  

Thanks

Nolan Lawson

unread,
Jun 17, 2016, 9:48:13 AM6/17/16
to PouchDB
Hi Glen,

PeerPouch is a bit out of date – it's only compatible with PouchDB 1.x, whereas the latest is 5.x.

PeerPouch is based on WebRTC, which is the only way to do peer-to-peer transfers in the browser. The reason that "you actually need to start with a centralized database" is because WebRTC is designed in such a way that you need a centralized server in order for the two peers to first find each other. Then the two peers can communicate in a truly p2p fashion.

If you're interested in this, I suggest checking out WebRTC itself (or maybe some helper library like http://peerjs.com/). Using that, you can use PouchDB and pouchdb-replication-stream and pouchdb-load plugins to:

1. Create a PouchDB in peer 1
2. Dump (e.g. using pouchdb-replication-stream or pouchdb-dump) to a string
3. Transfer that string via WebRTC
4. Load it in peer 2's PouchDB using the pouchdb-load plugin

Hope that helps!

- Nolan
Reply all
Reply to author
Forward
0 new messages