vibekōdo
Back to blog

Why I choose OP-SQLite over WatermelonDB on React Native

vibekōdo1 min read

WatermelonDB is a fantastic reactive database framework. it helps developers deal with realworld issues around data persistence on devices.

But it kind of does not work for my use case.

  1. WatermelonDB does not support specifying a custom primary key. (https://github.com/Nozbe/WatermelonDB/issues/964)
  2. The whole design of WatermelonDB is for the local-first apps. Which is something I want to handle by my self.
  3. I want to leverage the existing knowledge of Drizzle, I don't want to learn a new ORM.
  4. The bandwidth of the maintainer seems not enough, the issue of supporting React Native New Architecture is still open. (https://github.com/Nozbe/WatermelonDB/issues/1851)

So I decide to use a pure sqlite solution that works with drizzle cross all platforms.

On mobile, I use Drizzle with OP-SQLite.

On web, Drizzle works with indexedDB.

This way, I can share the most code between mobile and web for the local storage.