pubkey / rxdb

A fast, local first, reactive Database for JavaScript Applications https://rxdb.info/
https://rxdb.info/
Apache License 2.0
21.57k stars 1.06k forks source link

ANNOUNCEMENT: Plans for the next major version 13.0.0 #3883

Closed pubkey closed 2 years ago

pubkey commented 2 years ago

Plans for the next major version

So in the last major RxDB versions, the focus was set to improvements of the storage engine. This is done. RxDB has now multiple RxStorage implementations, a better query planner and an improved test suite to ensure everything works correct. This let to huge improvements in write and query performance and decreased the initial pageload of RxDB based applications.

In the next major version, I want to focus on the replication protocol. When I first implemented the GraphQL replication a few years ago, I had a specific use case in mind and designed the whole protocol and replication plugins around that use case.

But the time has shown, that the current replication protocol is a big downside of RxDB:

So I want to replace the whole replication plugins with a new replication protocol. The main goals are:

How will the new protocol work?

On the RxDocument level, the replication works like git, where the fork contains all new writes and must be merged with the master before it can push its new state to the master.

This works great with the already existing RxDB revision handling. A beta of the whole protocol is already implemented and used in the Memory Synced RxStorage. You can read the code of the replication here.

Will an old RxDB compatible backend work with the new protocol?

No. It will not work out of the box. But there will be ways to easily make it compatible and it will still be possible to resolve conflicts on the server side.

Please discuss.

Other planned changes

WonderPanda commented 2 years ago

Really excited about this one! I think that it could be a huge game changer when it comes to the types of applications we can build and adoption overall. Thanks for all the hard work you've put into RxDB

tjbo commented 2 years ago

Would be really great if we could add authentication (just being able to attach custom headers).

Right now I'm using syncGraphQl replication command, and from what I've read and looked at there is zero security on this, and no easy way to implement.

Just my 2 cents, great library otherwise.

tjbo commented 2 years ago

NVM my other comment, I just found:

 replicationState.setHeaders({
    Authorization: `...`
});
cetsupport commented 2 years ago

Regarding replication, here is one scenario we like to replicate via multiple protocols in IoT domain. For example:

Real time telemetry data should replicate via websocket subscription. Meanwhile, the history data like to use REST API.

We need merge data from those two parts together in right order. Suggest add this feature to roadmap.

chrisdrackett commented 2 years ago

I'm excited about the focus on replication. Our biggest pain-point on RxDB is that we need to keep managing our postgres + graphql server. It existed from before we started using RxDB, but it takes a lot of effort to keep it going. I've been thinking about moving to couch if only because it seems like managing the server would become much more work, but sounds like it might be a good idea to hold off on these plans until I know more about how this all is going to work.

chrisdrackett commented 2 years ago

@pubkey curious what the initial targets will be for a backend here. Will the focus still be on couch and graphql or something else?

johannesfritsch commented 2 years ago

+100 for local conflict resolution

pubkey commented 2 years ago

You can now try out the latest beta of RxDB 13.0.0. https://github.com/pubkey/rxdb/blob/master/docs-src/releases/13.0.0.md