My chaotic journey to find the right database

My chaotic journey to find the right database

Theo - t3․gg

3 месяца назад

120,913 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

@benji.mcdaniel
@benji.mcdaniel - 11.05.2025 13:39

idk.. syncing was simple for me. Any table you want synced, just add an "updated_at" timestampz, then on front-end when you want to sync, you just request all rows with updates after the "last_update" timestamp that you have locally. Yes, still keeping soft deletes on server, but locally, deleted them when you get the sync showing it deleted. That way local data doesn't keep growing with deletes. Then I also just refresh sync everything for data over 30 days old with updates, that way I can delete "deleted" rows after 30 days and any local client not updates within the last 30 days, will just re-sync it all.

The only issue with this approach but I rarely see it as an issue, users can change the data they have locally, which it won't sync those changes if use doesn't update the "updated_at" column, or they can delete data stored locally and that won't get synced again so it will just be missing. But, that could be worked around if you really needed per row syncing guaranteed. But come on, it's not that important. Sync on load, sync server to client when rows greater than updated_at appear in server, or client to server for the same. so simple. User messes around with their data directly, o-well, they can logout and login to refresh it all.

Ответить
@crowlsyong
@crowlsyong - 11.05.2025 12:04

I wonder if Deno Kv would come in handy here.

Ответить
@sykvel
@sykvel - 10.05.2025 15:33

Are you trying to convince us that $0.12 * 300 / month is expensive, but quater CPU VM with 512GB for $1500/month is a best deal?

Ответить
@abdulsalamsultanghaleb8134
@abdulsalamsultanghaleb8134 - 08.05.2025 06:35

Try rxdb

Ответить
@zuzelstein
@zuzelstein - 04.05.2025 11:40

Also why websocket solutions aren't viable for such problem?

Ответить
@betterinbooks
@betterinbooks - 02.05.2025 03:36

sounds like a skill issue.

Ответить
@guard13007
@guard13007 - 02.05.2025 00:35

Damn. I'm impressed just throwing everything back and forth for sync worked that well for that long.

Ответить
@hillgardsam6698
@hillgardsam6698 - 24.04.2025 13:41

Dexie deserves more praise than this video does. :) Dexie is what Whatsapp web and chatgpt web use to deliver ultra fast local first experiences. To me, Whatsapp web is the standard. It's really good and works on mobile. The only caveat is I don't understand why you'd load the full chat history in indexedDB when most use cases would be concerned with the 20 most recent chats. I do preload Dexie cache (last 20) + lazy load + Supabase realtime. But I didn't hit scale yet. So we'll see.

As of now, when you hit "chat" it's a near instant experience.

Kudos for memorizing everything that should rerender. When using dexie uselivequery, this is something you should take responsibility for.

+ You're using virtualization! Awesome that you mention that, I have yet to implement it.

Ответить
@uiopuiop3472
@uiopuiop3472 - 22.04.2025 15:06

i am nostalgic for this look of yours

Ответить
@davidheidrich3676
@davidheidrich3676 - 19.04.2025 19:25

I can also recommend RxDB (e.g. with dexie)

Ответить
@Luc398
@Luc398 - 18.04.2025 22:38

We did something like this in firebase. We stopped because even like this it was a ton of work

I always thought the way of doing this time of sync is using event sourcing.

This can potentially solve some of the sync problems and paginate a little bit of the information

Ответить
@matthew_linkous
@matthew_linkous - 15.04.2025 00:54

You should have just used Triplit! Would have solved all of your issues (real time sync, partial sync, authorization, etc) and is all managed in Typescript

Ответить
@mirothedjmusic
@mirothedjmusic - 11.04.2025 06:45

Exactly what i been looking for.

Ответить
@carlosverdes
@carlosverdes - 09.04.2025 13:24

have you consider using Event Sourcing for state?

Ответить
@wspak2628
@wspak2628 - 02.04.2025 11:04

Ferretdb ???

Ответить
@kennethbundy3862
@kennethbundy3862 - 25.03.2025 06:24

I have done this differently - with the yjs and an indexeddb provider. That being said, it might be too slow for the scale of the data here

Ответить
@priyanshshah6905
@priyanshshah6905 - 24.03.2025 12:37

i have a question, I hope someone can answer,if the userID is ever exposed on client side, and you already know the threadID isnt it possible for someone to guess a userID if there are enough users to edit another Users chat? I know its quite unlikely but just wanna confirm I understand

Ответить
@bowser_inthe_darkworld2
@bowser_inthe_darkworld2 - 24.03.2025 00:11

this was very interesting

Ответить
@MarcelSamyn
@MarcelSamyn - 23.03.2025 19:12

Totally agree that “does the code look cool” is a great metric (not sarcastic; programmer intuition matters).

Ответить
@zyxwvutsrqponmlkh
@zyxwvutsrqponmlkh - 20.03.2025 07:48

AI has broken language, I bet if you chart the number of times people on you tube videos say 'dive' it has hockey sticked in the last couple years.

Ответить
@div0ky
@div0ky - 19.03.2025 08:31

We had nothing but trouble with PlanetScale and moved to Neon and couldn’t be happier. For us, Neon has been amazing and PlanetScale is nothing but nightmare fuel. I am having trouble fathoming the praise for it.

Ответить
@ravikumarmistry
@ravikumarmistry - 17.03.2025 15:42

Gun js can solve ur problem of real time sync

Ответить
@senbatifanola
@senbatifanola - 16.03.2025 19:39

What is the problem with Websockets?

Ответить
@nirnejak
@nirnejak - 14.03.2025 01:06

this is the type of video I want to watch

Ответить
@MuradBeybalaev
@MuradBeybalaev - 13.03.2025 00:13

Every time he said "sync layer," my brain had to momentarily wonder: "what does some random guy named 'Sinclair' have to do with any of this..?"

Ответить
@gadgetboyplaysmc
@gadgetboyplaysmc - 10.03.2025 19:43

What about YJS my g

Ответить
@samuelese22
@samuelese22 - 09.03.2025 01:59

I’m not a Dev but I like to watch them squirm in pain and question their life choices 😎😂

Ответить
@moasfarjaved8384
@moasfarjaved8384 - 07.03.2025 22:34

A lot of this in-client DB logic is what we use in mobile apps to not show as much loaders as possible but the drawback is maintaining two different databases and syncing downstream clients whenever smth is changed upstream

Ответить
@btarg1
@btarg1 - 06.03.2025 00:11

I'm building an app now with a dexie layer that syncs up with the server, I thought that was a great idea but now you're giving me second thoughts lol

Ответить
@kevingaulin1478
@kevingaulin1478 - 02.03.2025 04:23

Is redis only in memory databae so if it's go down all data is lost ?

Ответить
@nazarshvets7501
@nazarshvets7501 - 28.02.2025 03:13

Didn't watch video. Answer is postgres, right?

Ответить
@edoga-hf1dp
@edoga-hf1dp - 25.02.2025 17:37

Would SQLite client side and mysql server side using migrations?

Ответить
@maximenadeau9453
@maximenadeau9453 - 25.02.2025 02:49

99.9999% of apps made today could use sqlite or basically read from a file dump + memory and be fine.

Ответить
@iykazorji8171
@iykazorji8171 - 24.02.2025 22:33

Thanks for mentioning Legend State! Definitely has piqued my interest. Seems to have a pretty low overhead sync solution with a backend compared to other solutions I have come across so far.

Ответить
@deviantech
@deviantech - 24.02.2025 22:28

Always funny when Theo makes a video about something he has no freaking idea about! Should it not be possible to at least know the proper terms after spending 1 months on a topic?

- "offline first" means "the main workflow works offline "with the latency and resilience benefits that brings
- "local first" means specifically that the app needs to be resilient to the company and servers going away and having realtime and collaborative features, so nothing theo is remotely interested in
- linear is neither of those, it just uses limited amount of offline first concepts to improve UX and apart from that it tries to piggyback on the local first movement without sharing any of the values or other aspects
- caching concepts are enough for the use-cases where you want to mainly view and create something. Local first comes into play when you need TO WORK with the data in an app (eg. sorting emails, managing calendars, editing notes)

Ответить
@bobkelso5681
@bobkelso5681 - 24.02.2025 13:30

Use RxDB

Ответить
@kevharv
@kevharv - 24.02.2025 07:07

Perhaps I’m unskilled, but if I start a new project I’m going for PostgreSQL or DynamoDB.

Ответить
@rrm4cy
@rrm4cy - 24.02.2025 06:27

I had pretty good luck back in the day with Couchbase. We did something very similar to what you ended up doing here. It was possible to query thousands of keys at once and sending them down as a package.

Ответить
@rainhorse3
@rainhorse3 - 23.02.2025 22:03

caring about alpha nerd stuff instead of things your users actually care about... never fall in that dev trap. No one cares that your sidebar state isn't finalized after 0.25 seconds

Ответить
@marcusbuffett9223
@marcusbuffett9223 - 23.02.2025 22:00

Excellent video, appreciate all the knowledge share from this migration

Ответить
@UnwittingSweater
@UnwittingSweater - 23.02.2025 21:52

MYSQL, I'm only gonna use MYSQL. It can do all the things and you lernt it in school and you can around with the boys.

Ответить
@Lemmy4555
@Lemmy4555 - 23.02.2025 04:30

This video has 1% DB and 99% FE hacks

Ответить
@andreistoica6693
@andreistoica6693 - 22.02.2025 20:28

Why was using websockets for syncing such a bad thing?

Ответить
@nikitaproit
@nikitaproit - 22.02.2025 19:12

Json by key on disk like dynamo and etc instead of redis/mysql should be better. But it also should be almost free with event stream / "big-table" instead of full sync.

Ответить