datascript

Dave Mays 2023-08-09T13:51:11.407249Z

I imagine datascript is often being used for an offline-first db, and synced back to something more persistent like XTDB. Are there any best practices / guides to something like this?

oly 2023-08-09T14:52:26.574329Z

I am doing exactly this, but would be interested in how other approach it in case I can improve things. currently I store the db in local storage and then submit it over to xtdb creating a new version, but this is reliant on a button the user clicks, I also have to run queries to grab the data and format it to send over the wire as I don't store the whole document in xtdb. But I can answer question about how I am doing it, but I recon there are likely better ways 🙂

👍 1
Niki 2023-08-09T15:23:39.370219Z

On the server, the current best way is https://github.com/tonsky/datascript/blob/master/docs/storage.md#storage-new-hot-best

Niki 2023-08-09T15:24:13.644949Z

On the client, yeah, probably tricky

sergey.shvets 2023-08-09T16:15:24.908319Z

There were a bunch of attempts already with datahike probably the best one. Check out links here in the Datalog resources if something fits your needs: https://github.com/simongray/clojure-graph-resources

sergey.shvets 2023-08-09T16:16:15.235509Z

But I don't think there is a reliable solution to sync frontend datascript into some persistent storage on server yet.

grounded_sage 2023-09-03T22:56:50.840349Z

I did the port of Datahike to cljs but it was a long process and fell too far behind main. Performance also needed work. A lot of work was needed and not enough funds or interest to continue work on it. I still hope it can land one day and would definitely revisit the work on it given the funds to do it because it would be good having Datahike on the front end with sync to a backend.

2023-09-01T07:03:58.455189Z

I use Datascript on the frontend with re-posh and Datomic Ions on the backend. In Datascript I keep the correspondence between Datascript IDs and Datomic IDs . My transactions are sent to Datomic and the resulting transaction is then run locally in Datascript.