Live data from Hacker News

PGlite – Embeddable Postgres

pglite.dev

11–20 of 118 posts

Re: PGlite – Embeddable Postgres

#11
post #6

This is very cool. Having to always set up a server is one major downside of Postgres, with cumbersome updates being the second. This solves the first and has potential to help with the second. Is there a way to compile this as a native library? I imagine some of the work should be reusable.

Took the words out of my mouth, i can think of many use cases for this.

Imagine being able to go from 'embedded' to 'networked' without having to change any SQL or behavior, so cool.

Re: PGlite – Embeddable Postgres

#14

Earlier quoted context omitted.

Hmm single user website run as HTML from some folder? I guess you could embed this from s3 for multiple users but probably this would be like running multiple engines from the same dir.

> Hmm single user website run as HTML from some folder? Why not just sqlite then?

More SQL functionality?

Re: PGlite – Embeddable Postgres

#15
I'm using this with a Bun project for my testing needs. I spin PGLite at the beginning, throw it all away at the end. It's not as nice as transactionally isolated testing (a la Ruby on Rails, or Elixir), but it's a fine replacement until I have time to replicate it.

Re: PGlite – Embeddable Postgres

#16
Hey everyone, I work on PGlite. Excited to see this on HN again.

If you have any questions I'll be sure to answer them.

We recently crossed a massive usage milestone with over 3M weekly downloads (we're nearly at 4M!) - see https://www.npmjs.com/package/@electric-sql/pglite

While we originally built this for embedding into web apps, we have seen enormous growth in devtools and developer environments - both Google Firebase and Prisma have embedded PGlite into their CLIs to emulate their server products.

Re: PGlite – Embeddable Postgres

#17

Earlier quoted context omitted.

Hmm single user website run as HTML from some folder? I guess you could embed this from s3 for multiple users but probably this would be like running multiple engines from the same dir.

> Hmm single user website run as HTML from some folder? Why not just sqlite then?

Postgres features are much nicer, honestly if you are using any sort of orm none of this matters. by design they isolate you from many of the more interesting features of the database. And in general this is probably a good thing. But if you enjoy hand writing artisanal sql postgres is far more pleasant to use than sqlite, not that sqlite is bad, it is very good, just... thin after using pg.

Re: PGlite – Embeddable Postgres

#18
post #5

It's cool that this is possible, is this just for fun or are there good use-cases for this?

It's now used by a huge number of developers for running local dev environments, and emulating server products (Google firebase and Prisma both embed it in their CLI). Unit testing postgres backed apps is also made significantly easer with it.

Re: PGlite – Embeddable Postgres

#20
Using this for testing... it feels like a sweet spot between in-memory SQLite and spinning up a full Postgres instance. I'd been looking for this for a while and I'm pretty happy with the faster tests. And so far no blockers from its limitations.
Post reply on HN