Remix.run Logo
rudedogg 4 days ago

I’m doing offline-first apps at work and want to emphasize that you’re constraining yourself a lot trying to do this.

As mentioned, everything fast(ish) is using SQLite under the hood. If you don’t already know, SQLite has a limited set of types, and some funky defaults. How are you going to take this loosey-goosey typed data and store it in a backend database when you sync? What about foreign key constraints, etc., can you live without those? Some of the sync solutions don’t support enforcing them on the client.

Also, the SQLite query planner isn’t great in my experience, even when you’re only joining on ids/indexes.

Document databases seem more friendly/natural, but as mentioned indexeddb is slow.

I wish this looked at https://rxdb.info/ more. They have some posts that lead me to believe they have a good grasp on the issues in this space at least

Also, OPFS is a newish thing everyone is using to store SQLite directly instead of wrapping IndexedDB for better performance.

jitl 4 days ago | parent | next [-]

I've been a bit put off by rxdb's lack of transactions (see https://rxdb.info/transactions-conflicts-revisions.html) and the sometimes self-congratulatory tone in their docs.

Notion is a very async collaborative application and we rely on a form of transactions. When you make a change in Notion like moving a bunch of blocks from one page to another, we compose the transaction client-side given the client's in-memory snapshot view of the universe, and send the transaction to the server. If the transaction turns out to violate some server-side validation (like a permissions issue), we reject the change as a unit and roll back the client.

I'm not sure how we'd do this kind of thing with RxDb. If we model it as a delete in one document and an insert into another document, we'd get data loss. Maybe they'd tell us our app shouldn't have that feature.

nchmy 4 days ago | parent [-]

Yeah, their tone can be a bit weird sometimes, but its by far the best browser db that I've found.

You could always ask your question in their discord - I've always gotten prompt and helpful responses

nchmy 4 days ago | parent | prev [-]

I am continually bewildered how no one ever gives RxDB, which has been around for many years longer than the rest of these tools, any love.

It has so many optimizations and features that the others dont. And is even better when you use the premium addons. I compared it to pretty much everything, and its not even close.