Ask HN: Wouldn't it be cool to have a Supabase for SQLite?

thenorthbay | 26 points

All the features you requested Turso can do, no?

> - SQLite runs next to server as production database

Embedded Replicas[1]

> - In dev, some sort of worker auto-copies the prod DB to the local repo. Production bugs can be reproduced easily and code fixed quickly

Maybe not exactly this, but you can replicate a DB from another with the CLI tool. Then just use that as a dev db.

> - Have an interface that lets you access, view, and modify data in the production DB, kind of like Firebase. Might need a server of its own... or couldn't that just be the app server itself?

I don't use their web interface, but I think it does allow this? I don't know for sure though.

> - SQLite auto-backs up to a bucket (like Litestream)

Turso does have point-in-time recovery[2]

[1] https://docs.turso.tech/features/embedded-replicas/introduct... [2] https://docs.turso.tech/features/point-in-time-recovery

whodev | 13 days ago

It's an obvious question, but have you looked into Pocketbase?

https://github.com/pocketbase/pocketbase

0x_rs | 13 days ago

I've been keeping a fork of MVSqlite (sqlite on foundationdb) maintained.

What is Mvsqlite? According to the author it's a distributed, MVCC SQLite that runs on top of FoundationDB.

https://github.com/V-Sekai/mvsqlite

Made an Elixir client, a Godot Engine client and CLI.

Supabase on Mvsqlite would be great! I am still puzzling over Mvsqlite's write performance, but its read performance makes sense to me.

# ycsb (workloadf, 10000, --wire-zstd)

Run finished, takes 1m18.086881433s

READ - Takes(s): 78.1, Count: 99957, OPS: 1280.3, Avg(us): 27061, Min(us): 1409, Max(us): 98751, 99th(us): 59391, 99.9th(us): 81791, 99.99th(us): 94591

READ_MODIFY_WRITE - Takes(s): 78.0, Count: 50061, OPS: 641.6, Avg(us): 69636, Min(us): 13320, Max(us): 205823, 99th(us): 121215, 99.9th(us): 189823, 99.99th(us): 203007

UPDATE - Takes(s): 78.0, Count: 50095, OPS: 642.0, Avg(us): 42630, Min(us): 7792, Max(us): 200319, 99th(us): 81535, 99.9th(us): 175487, 99.99th(us): 195199

From the github actions tests the original author wrote.

iFire | 13 days ago

Working on it! => https://www.airsequel.com

adius | 13 days ago

Hey thenorthbay,

I gotta say, your idea of a Supabase-like system for SQLite got me thinking. It's an interesting concept. SQLite running next to your server could certainly speed things up, but don't forget about potential issues with concurrent writes. SQLite might not be as graceful as other databases in handling those.

The dev-prod synchronization you mentioned is a neat idea. Just remember to keep things secure and don't expose sensitive data. Also, think about the size of your production database. If it's too big, this might not be the best way to go.

Having an interface to access, view, and modify data straight from the production DB would be super useful. Depending on how complex this gets, you could either make it part of the application server or set up a separate server.

Auto-backup to a bucket is definitely a thumbs up from me. Tools like Litestream can be a lifesaver here.

Have you heard of Datasette? It's an open-source tool that lets you explore and publish data from SQLite databases. It could be a good starting point for what you're trying to build.

Your idea sounds like it could really shake things up. Keep us posted on how it goes. Good luck!

DevNinjaS | 12 days ago

So like a normal SQL-server (PostgreSQL, MariaDB..), but with SQLite as backend. Which makes moving data simpler, as you only need to copy a file and can thus utilize the whole shell scripting-power. Well, seems like a nice idea for the dev, but how well can SQLite perform in a real production-environments with parallel writing? The only solutions I've seen so far are either relative poor, or "cheat" by using a separate file for each customer, which is not working with all use cases.

Anyway, there is a new generation of database-systems/frontends, like Grist, NocoDB, Airtable, etc. But they are more focused on a user-friendly all round experience, not so much a good experience. But some of them do support working with SQLite.

PurpleRamen | 13 days ago

Leaderless, eventually consistent DB, with DB running on same servers as app.

Could be good, you need to rethink all the distributed DB stuff.

Does a node deal with certain subset (e.g. certain customers) so you use customerid as a partition key.

CRDTs?

Once a node fills up to say x% capacity do you split that out (using consistent hashing to minimize effect of such spits).

You probably end up reinventing one of the distributed DBs once you make it production ready.

I think it is a lot of work unless you have simplifying requirements e.g. just give each customer a seperate VM and then use a mounted cloud storage to scale up space to some max like 10Tb then maybe cap it there. Write your db log to s3 glacier for a backup.

Second replica for failover.

datascienced | 12 days ago

Not directly an answer, but similar what if thinking got me wondering: wouldn't it be cool to be able to use postgres much like how you use sqlite with python? I implemented this idea as a pip-installable python package, https://github.com/orm011/pgserver, and your feedback would be great :) I use it for my projects.

orm | 13 days ago

If I understand correctly, the SQLite library would be embedded in a sidecar processes that would run on the same machine as the app main process, instead of having the SQLite library embedded directly in the app main process? But then, what's the point of using SQLite? What makes SQLite reads and writes so fast is that it is running embedded in the app process. If you don't need that, and you want a client-server architecture, then you can simply run PostgreSQL or MySQL on the same machine, also as a sidecar process (or as a subprocess of the main process), and communicate using UNIX domain socket.

ngrilly | 13 days ago

Certainly interested in having more solutions helping use SQLite. At dstack.ai, we use SQLite and love it.

- For our hosted version, we use Litestream; we lack a UI for accessing data.

cheptsov | 10 days ago

SQLite reads and writes are already very fast, in particular because it's running in process.

The minute you put it behind a socket, you lose that benefit. Also you would have to implement an efficient wire protocol.

I just don't see the added value here.

aspyct | 13 days ago
cosmicproc | 13 days ago

for dev there is already pg-lite server (postgres as nodejs/wasm) you can spin up, it's self-contained single-folder db to disk, 100MB RAM thingy. Highly experimental. Not sure if supabase codebase is setup for debugging the way you suggest.

https://github.com/kamilogorek/pglite-server

theage | 12 days ago

Pocketbase sounds like what you're describing.

foxandmouse | 13 days ago

Exactly what you describe but not free [1]

1. https://subzero.cloud/

ruslan_talpa | 13 days ago
[deleted]
| 13 days ago

You can do all of this with Postgres.

endisneigh | 13 days ago

All those features sound simple to do by hand, so if it doesn’t exist already, you should make it.

syndicatedjelly | 13 days ago
[deleted]
| 13 days ago

That's precisely what we are building at https://sqlitecloud.io

marcobambini | 12 days ago

So… pocketbase.

cchance | 12 days ago