Dev Blog #3 - Offline Version??

Published: .

Edited on: .

Hey again, sorry its been a while. I haven't worked on the app for a few months a couple of reasons - partly just busy with other things (you know like doing a real job), but also in significant part because I have been having major analysis paralysis over the implementation of the Offline Mode of the app.

Brief background on the feature - the original app implementation was "cloud-first", in that local data was at most cached versions of things and every change the user made was sent directly to the server first. This comes with a number of drawbacks including perceived performance, but primarily the reason this had to change was to implement a Free version of the app. With Offline Mode, a new user could immediately begin logging plants with no Account Creation or other interaction with a server - again, serious UX benefits here but primarily this means it costs me nothing to run for those users.

The catch though here is that de-syncing Local and Cloud state means that at some point we will have to re-sync it, which brings us to my point of analysis paralysis. If you haven't heard the term before, it neatly describes the sense of overwhelm when presented with many solutions to the same problem (which framework should I use, which database etc). But my quandary was on "what local database should I use for React Native" - Googling this yourself will reveal many suggestions.

I looked at several options - Firebase, WatermelonDB, Realm and more. But in the end I decided to go for the simplest option available - React Native Async Storage. Using such a basic storage system means that I have to implement everything I want essentially from scratch, including the crucial Syncing logic. However, after messing around for quite some time with different DB libraries, I decided that I would much rather spend a week enjoying writing some myself from scratch (and learning valuable skills the whole way), than spend probably less time trying to get Libraries working with Expo and hating my life every second of the way.

Anyway in the end I managed to do most of this work in <2 days, and here we are with a working Offline Mode. I need to spend some more time calculating the results of certain edge cases and seeing if they need to be handled, but overall it works nicely.

So, whats next? I've drafted the email announcement of Thirty Plants V1 and decided what needs to be done for that... mostly its just polishing the public-facing website, terms and conditions etc.

Ok anyway cya