dao-xyz / peerbit

P2P database framework with encryption, sharding and search
https://peerbit.org
Apache License 2.0
165 stars 11 forks source link

Consider being a backend for RxDB and abstract-level #25

Open TheRook opened 1 year ago

TheRook commented 1 year ago

Peerbit is a backend for rxdb and could be a great abstract-level database. Writing a backend module for these platforms will generate buzz within these communities and generate interest.

https://rxdb.info/offline-first.html https://github.com/Level/levelup (abstract-level)

rxdb uses pouchdb as an adapter: https://rxdb.info/adapters.html which is supported by orbit: https://www.npmjs.com/package/pouchdb-orbit

peerbit could be a backend for pouchdb which could then be an rxdb adapter. Getting more compatibility.

marcus-pousette commented 1 year ago

Great idea, I agree with you! Would be a super cool abstraction to unlock more usecases for this project and make it easier to use as well.

TheRook commented 1 year ago

Devs who are already writing a pouchdb or rxdb client apps are in a good spot to adopt peerbit. Seeing as you and orbitdb are the only free games in town, it is a no-brainer for a startup with no capital.

TheRook commented 1 year ago

Great idea, I agree with you! Would be a super cool abstraction to unlock more usecases for this project and make it easier to use as well.

Another possible abstraction is forking couchbase-lite-core and using peerbit as the preferred backend. https://github.com/couchbase/couchbase-lite-core

This is the core, which becomes the IoT, RaspberryPi, iOS, Android and WASM Embedded DB. If the target is in a mobile app it can use the C++ libp2p client to access the network then its game on. If it is in the browser using WASM then it can use a fallback gateway such as cloudflare's IPFS gateway to pull in the files and update the offline database - and still get a fast offline experience that we see in webworkers.

The end result would be a new dapp platform and I wouldn't call it CouchDB or peerbit anymore. It can make an existing app more impressive at a hackathon and works well on a wide range of platforms, so if you are at a solana or ethereum hackathon you can drop in zk memberships and an encrypted filesystem for private searchable data. Any poor college student at any hackathon can pick this up and have a shared database. Ideally it would be a kind of "international space station of web3" that is chain agnostic just as the ISS works with many different counteries that all have their own currency. We still need open standards, and forking couchbase-lite means that not only apps already written for this platform, but developers who have learned how to use technology can now develop apps for a web3 ISS project.

marcus-pousette commented 1 year ago

Interesting. Never played with anything from couchbase before, but I see where you are going with this. Couchbase brings more of the standard interface people are expecting from a database in general which might not be true for Peerbit out of the box. Challenges are however, that some of the features, for example sorting and aggregation (iterating over documents in a particular order) might be quite tricky to achieve in the same way in a distributed setting where people are responsible for storing different parts of the database in comparison to more traditional solutions where there might be a centralized middleware that can dictate who is going to store what, and can coordinate aggregation and sorting queries. (this might also perhaps be an interesting challange if you wanna make this compatible with level).

Though, I am confident though that it is possible to achieve things you have outlined above, or at least bring more value to developers that are today using similar tools. I am very enthusiastic building the tools that allows anyone no matter the economical and technical background to setup a distributed, discoverable and secure state with minimal amount of dependencies. A goto thing you would use during a hackathon as you said.

But before I digging into this, I would want to stabilize the project a bit more by solving the other issues (that might impose some constraints/compatibility issues that I can not foresee right now)