Skip to main content btwn u n me

Bringing Meraki Online - 3. Data Schema

Two days to go till the Feb 20th deadline…

Got a bit preoccupied with work and a friend in town but time for actual business logic which is the fun part. My backend uses a postgreSQL database and so defining my schema was fairly straight-forward. I already has some logical structure with realm which I modified slightly to leverage a user_id foreign key to the authentication table and also added some additional data to track future features like shared lists and subscriptions. PostgreSQL Functions also enabled me to create some helper utilities like creating default data for new users.

Unknowing to this when I started, but one long standing shortcoming with Supabase is its offline support. By nature of the app, I needed to be offline-first as I’d like to use my app in my local whole foods which is underground and has no service or when I remember something on a flight, I shouldn’t have to worry about whether I’m online or connected.

After some researching and debating between switching to AWS or firebase I found that the CEO of Supabase recommended PowerSync. PowerSync acts as a middle man that syncs data from the Supabase backend to a local SQLite database on the client side. I think that this is the best approach for now but it does bother me that I have to add an addition dependency and also the costs could add up, but that’s a generally good problem since it means there’s actual users.

For now I’m diving into PowerSync sync rules and defining which buckets of data to share to users. Keeping it simple to start with which in general I’d argue is the best approach. It took me a bit of time to understand how to work with sync rules but once you get going its not bad and PowerSync also provides an online tool to debug and inspect the sync rules from the perspective of a test user.

I “hope” thats all I’ll need for now on the server side. In the next post I’ll be starting to dive back into the client side and the iOS app’s architecture to interface between the current on-device backend, Realm, and the new version.

Bringing Meraki Online - 2. Auth is Hard