Fork me on GitHub
#datascript
<
2020-01-09
>
Filipe Silva16:01:05

Heya, just wanted to let you know that datafire is now available as 0.1.1 at https://github.com/filipesilva/datafire. It lets you persist Datascript databases in Firebase's Firestore. Supports offline usage and multi-user synchronization. You can use Firestore Security Rules to limit access. If you're persisting Datascript and this fits your usecase let me know, and also let me know if you've been looking for something like this but with more features. Very interested in how this setup can be pushed further.

👍 12
carocad12:01:06

Interesting, I did something similar but with sqlite. However I used the listen! Directly inside the library instead of on user code. That way the user could still keep using Datascript/transact! Instead of the library one

carocad12:01:30

PS: it would probably be good to publish this on #announcements to reach more people 😉

carocad12:01:46

Question: is there a way to restore the local Datascript from firestore? Or is the local one always assumed to be the master? I'm thinking of a it who opens the same app on another computer/phone

Filipe Silva13:01:22

I did put it on accouncements, or news and articles

Filipe Silva13:01:50

well both of them, but since cross posting between them is not allowed, the other one got taken down

Filipe Silva13:01:36

I kept the transact on this lib because the loop needed to be firestore as the canonical source

Filipe Silva13:01:52

stuff might happen before it hits firestore, for instance

Filipe Silva13:01:05

the local datascript database is always restored from the remote

Filipe Silva13:01:49

if two people open it in different devices, they will both see the dame database

Filipe Silva13:01:17

they will also see each others writes

Filipe Silva13:01:56

all of that works offline too, if you enable firestore's persistence

carocad17:01:51

oh nice 🙂 thanks for the info

Filipe Silva19:01:39

let me know if you use it, and if it does what you need, and also if it doesn't 😄

carocad19:01:59

for the time being I probably wont use it since I dont have the need right now. However some months ago I was searching for something like that but couldnt find anything; which is why at the end I went with a local sqlite storage 😅 Maybe it helps you get some inspiration: https://github.com/hiposfer/hive/blob/master/src/hive/services/sqlite.cljs