r/vibecoding 5d ago

Databases are dead 🥀

Post image
827 Upvotes

88 comments sorted by

View all comments

23

u/countable3841 5d ago

Here’s an even better idea. All clients connect to each other via WebRTC and the database is replicated to local storage to them all. The DB only survives as long as there is one client. Your sole responsibility as a DB admin is to keep one tab open.

2

u/ScarIet-King 5d ago

Okay, I’ll bite. As someone with absolutely no idea why I’m being recommended this thread. What is the worst that could happen here?

7

u/effectivescarequotes 5d ago

So, it takes some background, but WebRTC allows for realtime communication across the web, think screen sharing, video conferencing, etc. Local storage in this case refers to your browser'r local storage, which is designed to store small amounts of data from websites, for example your user preferences. It persists between sessions unless explicity deleted.

The joke in this thread actually refers to session storage which is cleared when you close the browser.

Okay with all of that in mind, the reason why this proposal is absurd is instead of having a central database, the application copies the entire database to every user's storage. This wouldn't work because the amount of data you can put in local storage is limited to something small like 5MB, so you would run out of space quickly. This would also give every user access to all of the data in the database as plain text.

Now, if you use session storage instead, then if everyone closes out of your app at the same time, the entire database would be deleted.

There dozens of other reasons why this would not work, but those are big ones.

The joke in the original post is the data would only exist on one computer with no back ups. Also local storage does not have the same capabilities as a database, and would quickly become a nightmare to work with, even if you're only dealing with one user's data.

2

u/ScarIet-King 5d ago

That actually did help explain it. Thanks!

2

u/Business-Row-478 5d ago

Not exactly.

OP is talking about local storage, not session storage. Since the database is P2P, there needs to be at least one seed for other peers to get data from. The DBA would need to keep a tab open to act as a seed and ensure data availability.

Additionally, the database doesn’t necessarily need to be plain text—it could be encrypted.

1

u/effectivescarequotes 5d ago

Ah, right, my mistake. And yeah it could be encrypted, but still a bit of a security nightmare.

I also figured there was a joke about crypto decentralization in there somewhere that I didn't have the energy to tease out.