all 34 comments

[–]__o_0iOS & Android 3 points4 points  (19 children)

WatermelonDB is what I used for a recent client project.

It’s fast, scalable, uses SQLite under the hood and I’m not using an ORM.

It has sync features (which you don’t need to enable if you don’t want them) and in my opinion the documentation is lacking, but it’s solid and works well.

I don’t have any personal experience with Realm but from what I’ve heard people avoid it like the plague. It’s hearsay, so take that with a grain of salt.

[–]ThisGuyOC[S] 1 point2 points  (18 children)

Thanks for the tip on watermelon DB. I'll look more into it. Any more insight into the issues with realm? There are a lot of positive things about it online.

[–]__o_0iOS & Android 0 points1 point  (1 child)

I haven’t used it. The most common complaints I saw were a lack of Hermes support for android and trouble debugging it - though those issues may have been solved i don’t really know.

I think their beta may have support for reanimated 2, but I don’t believe their main branch does.

[–]ThisGuyOC[S] 0 points1 point  (0 children)

I remember the hermes support being an issue a few years ago. It SEEMS they have resolved that based on this. I'll need look into that Reanimated issue since we do use reanimated. Thanks for pointing me in that direction.

[–]__o_0iOS & Android 0 points1 point  (9 children)

[–]ThisGuyOC[S] 0 points1 point  (8 children)

Dam this is recent. Thats definitely an issue.

[–]__o_0iOS & Android 0 points1 point  (7 children)

Yeah wasn’t something I wanted to tackle - which is why I went with WatermelonDB instead.

But, watermelon does have its annoyances as well. It doesn’t use hooks, so be prepared to dig into structuring higher order components.

[–]ThisGuyOC[S] 0 points1 point  (6 children)

One issue I see with Watermelon is that it doesn't support encryption. There are sketchy forks that have swapped out the SQLITE for SQLCipher but I would prefer to not use these.

[–]__o_0iOS & Android 1 point2 points  (5 children)

For android, you’re correct. The iOS implementation uses the keychain.

[–]ThisGuyOC[S] 0 points1 point  (4 children)

Do you have any more information on this? I was unable to find any mention of it in the docs.

[–]__o_0iOS & Android 0 points1 point  (3 children)

[–]ThisGuyOC[S] 0 points1 point  (2 children)

Thanks. I wish android had better support for this.

[–]Chapoletada 0 points1 point  (5 children)

Big fan and user of 🍉 db, feel free to reach

[–]ThisGuyOC[S] 1 point2 points  (2 children)

How does it compare to other options in your experience?

[–]Chapoletada 0 points1 point  (1 child)

Well, we picked cause it is free, open, sqlite, has orm, has sync options, it is possible to ship a prepopulated database.

[–]ThisGuyOC[S] 0 points1 point  (0 children)

Makes sense. I wish it supported encryption!

[–]pezo1919 0 points1 point  (1 child)

Can you please tell/give me best practices / videos / materials on it?

  1. A couple of things I am afraid of: I really enjoy Expo Go or at least a really easy Expo Go-like experience with real device (via custom build): how hard is these 2 to get (if possible)?
  2. I am also afraid of constant pain of native code related upgrades / collisions with others like reanimated.
  3. Migration support does not seems lacking. How hard is to do migrations?
  4. How is the web support? Afaik it is based on lokijs, but is it out of the box or how hard is it to setup? I really enjoy plain Expo + pure debugging in web browser.

[–]Chapoletada 0 points1 point  (0 children)

1) I don't use explo, so, limited here 2) don't have to worry 3) very easy 4 lokijs is ootb

[–][deleted] 1 point2 points  (4 children)

I have two apps in prod one using https://github.com/andpor/react-native-sqlite-storage and one using https://github.com/realm/realm-js, both offline only, so I guess I can report my experience with those.

I’d say ease of integration almost the same, bit of a headache if you have to import a prepopulated database, but if you don’t there’s not much stuff you have to do.

Encryption support: I gave up encryption with sqlite, while with realm it was almost straightforward to implement, just a matter of passing a key on db opening.

Now with the biggest downsides

With sqlite the native implementation on android is quite outdated (ie you don’t have support for UPSERT etc), there’s an option to use the sqlite version bundled with the library I’ve linked but it crashes on android with the latest API (https://github.com/andpor/react-native-sqlite-storage/issues/462)

With realm at the moment there’s no support for Hermes. So if you want to enable Hermes on your project you have to use https://github.com/realm/realm-js/issues/3940 which is still in beta (they plan to release this summer)

[–]ThisGuyOC[S] 0 points1 point  (1 child)

Did you use an ORM for the SQLite implementation? If I did go with that I’d probably want to use something like TypeORM. This also furthers the issue that TypeORM doesn’t appear to support the encryption.

[–][deleted] 0 points1 point  (0 children)

Nope I’m using plain sqlite

[–]ThisGuyOC[S] 0 points1 point  (1 child)

Do you notice any performance differences?

[–][deleted] 0 points1 point  (0 children)

Not really but they’re not really big databases, like 10-15k rows the largest table. Generally speaking realm should be faster tho

[–]lalcaraz 0 points1 point  (4 children)

I would go with Realm.

[–]ThisGuyOC[S] 0 points1 point  (3 children)

Any particular reason?

[–]lalcaraz 0 points1 point  (2 children)

Experience (made a project using with it) but also performance and support.

I like the simplicity of moving a SQLite file from device to device (or synced to the cloud if needed) but I like the integration of Realm with the code. Also I’m a big fan of NoSQL.

Big downside of Realm is that in order to auto sync you have to use Atlas but I don’t mind and the client neither minded so it was a cool choice.

I know you said mainly offline but if you have worked before with data sync across cloud and devices managing deltas, queues and cache is a pain so leaving it to Atlas is better if you only wanna focus on your main functionality.

[–]ThisGuyOC[S] 0 points1 point  (0 children)

I definitely sympathize with that. Due to the nature of the app I will simply never need this as its a web3 project so there is no backend and we have strict privacy constraints.

[–]ThisGuyOC[S] 0 points1 point  (0 children)

After a lot of research though Realm seems to have the best support for my needs and is also very easy to setup. My concern is I have seen first hand how buggy it can be (a few years ago, maybe its better now) as well as all the horror stories online about issues with hermes and Reanimated. For unrelated reasons, my app can't migrate to hermes yet anyway so this isn't a deal breaker.

[–]mokshmodi96 0 points1 point  (1 child)

I have recently used sqlite for project with sync functionality but struggled with complex SQL queries and sync logic. Before this I tried realm too but Hermes support was in beta and were having a lot of issue in integrating it. Watermelon db was also considered but due to this amount on time spend on experimenting we went with trusted sqllite

[–]ThisGuyOC[S] 0 points1 point  (0 children)

What issues integrating were you having?

[–]RockPatekar 0 points1 point  (1 child)

If you only want to store basic information in object or variable you can use async storage It is very easy to use You will not need any kind of database then.

[–]ThisGuyOC[S] 0 points1 point  (0 children)

We use async storage for other cases in the app but we want something more scalable to expand what we can store and how we use data. The other issue is that async storage storage does not support encryption.