How difficult is to create an offline-first app? #533
Replies: 14 comments
-
This is a general question. I can't answer this without knowing what you need to do. Sorry, but I don't have time to dive into the article. |
Beta Was this translation helpful? Give feedback.
-
We are evaluating your project because we want to build a CRM-like that must have all the data and a 100% offline CRUD with synchronization once online. I cannot understand if we can achieve this with your project. Some of the questions in the article:
|
Beta Was this translation helpful? Give feedback.
-
Akita is a state management solution. You can persist the data to web storage. You can keep browser tabs in sync using localStorage. |
Beta Was this translation helpful? Give feedback.
-
Anything else you'll have to manage yourself |
Beta Was this translation helpful? Give feedback.
-
It would be amazing to sync state from browser to server just to handle offline situations. And I'm not talking about conflicts for now (I don't care at this stage, I can use "last writer wins" or handle the error in the server and communicate it to the single client). What do you suggest as an effective sync system to any backend? |
Beta Was this translation helpful? Give feedback.
-
I'm not sure what you mean by "an effective sync system to any backend"? Can you elaborate? |
Beta Was this translation helpful? Give feedback.
-
Hey @frederikhors, have you checked Pouchdb? It basically is a solution for your problem. However, you will need to have a backend running CouchDB our that implements CouchDB API. Akita is a state management library. With that being said, and complement what @NetanelBasal said, you can use Akita to BUILD your own solution. For sure you can do something more advanced, something like a CQRS + event system - but that will need you to work on the backend. Why Im telling you all this: |
Beta Was this translation helpful? Give feedback.
-
Something to synchronize the operations Akita saves in the browser once the connection with the server is restored. |
Beta Was this translation helpful? Give feedback.
-
We don't have this functionality. Can you give me an example of how you imagine a JSON representation of this? |
Beta Was this translation helpful? Give feedback.
-
May be you can use a service-worker for this: https://developers.google.com/web/ilt/pwa/introduction-to-service-worker When your user performs an action, add the result of the action to Akita and send the HTTP request through the service-worker. The service worker, on the other hand, would listen to successful requests and push the results back to Akita. |
Beta Was this translation helpful? Give feedback.
-
I am implementing something similar using Service Workers, IndexedDB and Akita ngEntityStore |
Beta Was this translation helpful? Give feedback.
-
@mattbodman I know this is not the scope for a/this github issue, but Id love to read about how you guys are implementing it, challenges and victories. |
Beta Was this translation helpful? Give feedback.
-
@frederikhors just want to give a bit of insite into this question as it may be of use to you or anyone else looking to implement an "offline first" application. My team have delivered a fully functioning "offline first" application using Akita as the data store. But, remember, Akita is just there to store your data and give you a nice way to access it. To "syncronise" with the server we have the following We have a isDirty property on every entity that is set using preAdd/preUpdate events. So far all of that is by far the easiest part of an "offline first" application. Dealing with multipe devices updating the same record, devices coming back online and syncing data that has been updated by other people/devies or system processes, handling application upgrades that change your API/schema and dealing with old versions of data. Keeping the application up to date when they are online.... all of these things presented a much larger challenge. Our app is quite complicated
The list goes on but, suffice to say quite complex. Any given user has roughly 20,000 records being synced to the Akita store. So, can Akita be used for what you are trying to do.... yes. But, you'll need to do the sync management work yourself. @NetanelBasal I'd like to thank you for your work on Akita as I have definitly enjoyed using it in our app. |
Beta Was this translation helpful? Give feedback.
-
I'm submitting a...
I only discovered this project today.
Congratulations for this great job!
In your opinion, how difficult is it to create an offline-first Web/Desktop/Native application with this project?
Anything that respects these rules?
Beta Was this translation helpful? Give feedback.
All reactions