Couchbase Lite and IPFS

Recently, I’ve been using Couchbase Lite in a few mobile apps. (It was originally based on CouchDB) Combined with Sync Gateway and Couchbase Server it’s a brilliant system, which solves a lot of common problems regarding local/remote data replication and user content sharing.

For a while now I have been thinking about how best make my data decentralised. I have two main aims: 1) Not needing to maintain and pay for a database server and 2) Be part of the decentralised data revolution :slight_smile:

For my current use-case I won’t need online queries, those will happen only once replicated to a device.

The way I see it there are two main paths to using Couchbase Lite with IPFS:

  1. Add a custom replicator, so that it can replicate to/from IPFS as well as other CBLite instances and Sync Gateway. CBLite now uses WebSockets and I wonder how this could interface with IPFS, in terms of broadcasting changes.
  2. Create a fork of Sync Gateway (which is itself written in Go) combined with libp2p to create a “service layer” that would handle replication between the CBLite database and the data store (which could be IPFS or something else).

Number 2 seems very ambitious to me. So currently thinking more about path 1. I’ve been looking into OrbitDB as an example of how to build a database on top of IPFS and there’s been some work on interfacing it with PouchDB which operates on the same basic CouchDB protocol as CBLite.

Posting here to see if anyone has any thoughts or advice on this idea.

1 Like

I just want to mention that I’d love to see IPFS to Apache CouchDB/Couchbase Lite replication. I still need to check myself if IPFS has everything that’s needed to fulfill the semantics of Apache CouchDB’s replication protocol.

Yes it would be great. It seems that Couchbase Lite and Sync Gateway are gradually moving away from the CouchDB standard though. The way Sync Gateway and Couchbase Lite sync is now over WebSockets rather than TCP (since 2.0), and I also found I had to use Couchbase Server in order to do filtered replication, forcing me to setup up a server running Couchbase and Sync Gateway, where I was previously using Cloudant. Hence my motivation to use IPFS instead!

Although the transport for Couchbase Lite 2.0 changes, the semantics are still the same (at least the last time I’ve checked).

1 Like