Live data from Hacker News

Postgres WASM

supabase.com

1–10 of 190 posts

Re: Postgres WASM

#2
Hey HN, we’re excited about this launch. This was a collaborative effort with the team at Snaplet [0].

postgres-wasm is an embeddable Linux VM with Postgres installed, which runs inside a browser. It provides some neat features: persisting state to browser, restoring from pg_dump, logical replication from a remote database, etc.

The idea was inspired by CrunchyData’s HN post about a month ago [1]. We love the possibilities of Postgres+WASM, and so Supabase & Snaplet teamed up to create an open source version. The linked blog post explains the technical difficulties we encountered, and the architecture decisions we made.

We’re still working hard on this, but it’s at a good “MVP” stage where you can run it yourself. Snaplet are working on a feature where you can drag-and-drop a snapshot into your browser to restore the state from any backup. Supabase are exploring ways we can run the entire Supabase stack inside the browser. You can find the Snaplet repo here [2], and the Supabase fork here [3]. There’s very little difference between these two, we just have a different browser UI.

Both Supabase team and the Snaplet team will be in here commenting if you want to know anything else about the technical details.

[0] Snaplet: https://www.snaplet.dev/

[1] Crunchy post: https://news.ycombinator.com/item?id=32498435

[2] Snaplet repo: https://github.com/snaplet/postgres-wasm

[3] Supabase fork: https://github.com/supabase-community/postgres-wasm

Re: Postgres WASM

#4
Peter from Snaplet here. A month ago I saw the CrunchyData post and wanted to play around with the code that made it happen, it wasn't OSS so I asked for help:

> If anyone out there wants to work on an open source version of this full-time please reach out to me. [0]

Paul reached out and we started working on it almost immediately. Check out the repo here: https://github.com/snaplet/postgres-wasm

We have a blog post about some of the interesting technical challenges that we faced whilst building this: https://www.snaplet.dev/post/postgresql-in-the-browser

Like most things, this is built on-top of the amazing open-source projects that made this possible, but special mention goes to v86.js and buildroot. We just glued it together.

My hope is that we as a community can own this project and make PostgresQL, and the software that runs on it, accessible to a larger audience.

---

[0] Request for collaboration: https://news.ycombinator.com/item?id=32500526

Re: Postgres WASM

#5
This is a really exciting milestone for WASM! Has anyone tried compiling postgres for wasm32-wasi and implementing a wasi-compatible interface for the file system and other OS bits postgres needs? I think that would be a big improvement.

Re: Postgres WASM

#6

Hey HN, we’re excited about this launch. This was a collaborative effort with the team at Snaplet [0]. postgres-wasm is an embeddable Linux VM with Postgres installed, which runs inside a browser. It provides some neat features: persisting state to browser, restoring from pg_dump, logical replication from a remote database, etc. The idea was inspired by CrunchyData’s HN post about a month ago [1]. We love the possibi…

The links at the bottom are broken; presumably the post was written in Markdown, HN doesn’t understand that.

Re: Postgres WASM

#7
post #6

Hey HN, we’re excited about this launch. This was a collaborative effort with the team at Snaplet [0]. postgres-wasm is an embeddable Linux VM with Postgres installed, which runs inside a browser. It provides some neat features: persisting state to browser, restoring from pg_dump, logical replication from a remote database, etc. The idea was inspired by CrunchyData’s HN post about a month ago [1]. We love the possibi…

The links at the bottom are broken; presumably the post was written in Markdown, HN doesn’t understand that.

Thanks Gurjeet - fixed

Re: Postgres WASM

#8
Very impressive technically, but what are the practical use cases for this? We have IndexedDB and WebSQL, so apart from the other comments mentioning using it in tutorials, I'm not sure what the value add is.

edit: as always, I should read the whole article first. The idea of using it as a dev environment is very cool.

Re: Postgres WASM

#9
The use cases here are going to be really wide spread in my opinion, just a few ideas off the cuff. Obviously the 30mb size means it won't really be for regular consumer apps, but for enterprise or specific tasks it can make a lot sense.

1. Training websites

2. Interview challenges involving SQL

3. Client side tooling that loads data into your local machine and displays into a SaaS web app without the SaaS app ever having your data

Appreciate the hard work from Supabase and Snaplet on this!

Re: Postgres WASM

#10

Very impressive technically, but what are the practical use cases for this? We have IndexedDB and WebSQL, so apart from the other comments mentioning using it in tutorials, I'm not sure what the value add is. edit: as always, I should read the whole article first. The idea of using it as a dev environment is very cool.

>We have [...] WebSQL

Not any more - iirc it was depreciated.

In the case of IndexedDB, I haven't looked into it, but Mozilla has the following to say about it:

>Note: IndexedDB API is powerful, but may seem too complicated for simple cases. If you'd prefer a simple API, try libraries in See also section that make IndexedDB more programmer-friendly.[0]

I suppose this project could make development easier by allowing developers to share server-side code? And it has the benefit of already having a large userbase.

[0]https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_A...

Post reply on HN