Hello everyone,
I wanted advice for how to go about implementing syncing data between a single page application(SPA) frontend and a backend API, which would then query the Neo4j database as required (using Bolt API).
My question is about data syncing. When the client(SPA) requires information, it does an API call asking for the resources, and it gets a JSON as output. My question is this: When changes are made locally (in the client side; with changes made to the JSON), how to reflect the same in the database?
Is there a simple way to do this? The best I could think of is: recording the changes in a format (e.g. given an object with key 2e4r3f, changes would be like: "favourited 2e4r3f", "modified 2e4r3f 'text it is now' ") and send those to the backend. What would you guys do?
Another question I have is about offline-functionality. This is an optional requirement, but I would love advice about this as well. If a user has opened up some pages when they are connected to the internet, I would like for them to be able to work on the pages even when they are offline. When the user later connects to the internet, these changes would need to be synced with the database.
For this, I was thinking of storing and managing the pages in a state management store (like Vuex, Redux). I do not particularly like this approach as I would have to rewrite what essentially could be done as Cypher queries to javascript. Do you guys have any ideas?
While searching for sth like this, I came upon Datascript which does this for Datalog. Is there a similar community project for Neo4j I could look at?
If it helps, I'm looking into VueJS as frontend, and FastAPI for the API.
Cheers,
Baibhav
P.S. My earlier question with regards to general advice relating to this project: General Advice for building a SPA in Neo4j