I am working on a web application written in Django and using PostgreSQL as the database backend. I'd like to spin up a ReactNative mobile app so that users can operate the app offline. I am concerned about managing database conflicts where a user takes one action offline on the mobile app, takes a conflicting action in the web app, and then the two actions need to be synced, conflicts managed, and merged.

I understand that you don't want ReactNative to connect directly to your PostgreSQL DB from ReactNative as discussed in this question. I also am aware of AsyncStorage in ReactNative. I am unaware of how to best integrate the two. I have seen several questions on syncing web app data with mobile data (e.g., this) but I am looking specifically for a PostgreSQL and ReactNative solution. I see a lot of results for DB solutions in ReactNative, but I am not looking for the new hotness or a pet project that will eventually not be maintained. I've also heard of RealmDB which looks great but does not seem to be free. In short, I am looking for the most reliable, simple, and proven solution for managing data in ReactNative and syncing with PostgreSQL.

I am asking now without any ReactNative code because I want to make sure I set up the ReactNative app correctly from the start, rather than having to go back and rewrite all my data storage code.

To use a very basic example, let's say while on the subway and without WiFi or mobile data, a user changes task_A from incomplete->complete. The user then jumps on his laptop after arriving at work and changes the state of task_A from incomplete->in_progress. When the user gets his mobile device on WiFi and syncs the app data there will be a conflict between the mobile data stored using AsyncStorage and the data living in PostgresDB.

What is the best data storage wrapper for ReactNative given the web application uses Django and PostgreSQL?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.