Offline Storage Synchronization and Implementations

Hi Community,

I needs input from all of you regarding offline storage in ERPNext.
localStorage object just for reference
Currently we’re using HTML localStorage to store assets only. But along with assets I also want to store whole ERP data while bootup process in localStorage. Even user have lost the internet connectivity still he’ll be able to use the ERP system, also able to save the transaction states and synchronize with ERP when it reconnect.

For Instance:
Every time when we open desk#List/Sales Invoice/List (relative to url) it send GET request to server for fetching all Sales Invoice’s. What if we store whole ERP data in while boot up process in localStorage and even users have no internet connectivity still they’ll be able to use the system.



This is non-trivial as link queries, naming (series) and validations happen on server side.


I have some links to some other projects that could possibly be integrated, or may inspire a solution. (in no particular order):-

For server-side validations: we could simply spit any rejections into the Error Log.

For naming series: suppose you create a Sales Invoice whilst offline, the middleware would return a GUID instead of a row ID. This would be used for the primary key whilst offline. When back online, it’s converted to an ID. The same for the naming series (eg Invoice #0001 might change to #0002 by the time it syncs to server. This shouldn’t break any links because Payment Entry etc should link to invoice via primary ID

Yes, we’d have to implement a client-side schema model, which would resolve the Link queries issue. This seems trivial (see also: GraphQL)

I really feel this would give a fresh “next” to ERPNext, as it’s …

1 Like

(note: there are 5 urls posted above, but at first glance only looks like 3. Please see all 5.

As the developer for Rekord if you have any questions feel free to ask.

Rekord provides a way to define your model’s data & relationships - and has 3 facades it interacts with. Local storage, remote storage, and real-time storage. You can use any of the supported plugins to implement any of the 3 facades. (this decoupling also allows you to switch technologies without having to change your code)

Storing things locally can be challenging, so Rekord provides things like “migrations” to migrate old local data to the new format.

Storing data to scale is also challenging, so Rekord also has horizontal scalability via sharding. This just means you define a function which takes the identifying fields of an object and provide which remote storage(s) should/might contain that object.

Although the documentation is incomplete at the moment, its not because of neglect. I’m busy using it in production applications!