Live data from Hacker News

Accidental database programming

sqlsync.dev

1–10 of 310 posts

Re: Accidental database programming

#5
post #3

Is this supposed to be run on the server? Then how does it really solve the frontend side of issues, I'm just trying to understand.

I sometimes see interesting links on HN but when I click on them and skim through, I still have no idea what exactly it does. This is one of them.

Re: Accidental database programming

#6
post #3

Is this supposed to be run on the server? Then how does it really solve the frontend side of issues, I'm just trying to understand.

It’s not exactly clear in the article, but there is a client part: https://github.com/orbitinghail/sqlsync/blob/main/GUIDE.md

> Step 2: Install and configure the React library

Re: Accidental database programming

#7
I'm currently writing a very similar article about "full-stack databases" which highlights the same pattern where many apps end recreating the logic of our backend and database in the frontend client code. The solution we're promoting is to choose a database that can run on both the server and in the client and then sync between them.

The reason we aren't using Sqlite for our product is because Sql is frankly not the right tool for querying data for an application. It doesn't easily map to the data-structures you want in your client code and nearly all SQL databases have no way to subscribe to changes to a query without polling the query repeatedly.

So if you like the idea of having a complete database on your client but also want deep integration with Typescript/Javascript check out what we're building at https://github.com/aspen-cloud/triplit

Re: Accidental database programming

#8
post #7

I'm currently writing a very similar article about "full-stack databases" which highlights the same pattern where many apps end recreating the logic of our backend and database in the frontend client code. The solution we're promoting is to choose a database that can run on both the server and in the client and then sync between them. The reason we aren't using Sqlite for our product is because Sql is frankly not the…

postgres has some capability to do that, but does need a server.

Re: Accidental database programming

#9
Can someone explain me how it's syncing the state between two different devices without any activity in the Network tab in DevTools, not even WS traffic?

I get that you can sync state between browser tabs, but I'm trying on two different devices (iPhone and Desktop).

And as far as I can tell, the Wasm layer can't perform network requests directly.

UPDATE: In the console tab I can see 'coordinatorUrl: 'wss://sqlsync.orbitinghail.workers.dev', but I was expecting to see this Websockets connection in the Network tab, and it isn't.

Re: Accidental database programming

#10
post #8
post #7

I'm currently writing a very similar article about "full-stack databases" which highlights the same pattern where many apps end recreating the logic of our backend and database in the frontend client code. The solution we're promoting is to choose a database that can run on both the server and in the client and then sync between them. The reason we aren't using Sqlite for our product is because Sql is frankly not the…

postgres has some capability to do that, but does need a server.

Yeah you can subscribe to overall changes to the data on a row by row basis but can't subscribe to an actual query. Many apps and libraries imitate reactive queries by just refetching all queries from Postgres when any data changes or just repeatedly polling the query every 10 seconds or so but this puts a lot of strain on the database. You can just subscribe to the replication stream but then you're left trying to reconstruct your queries in your application code which is extremely error prone and painful
Post reply on HN