Live data from Hacker News

PGlite – Embeddable Postgres

pglite.dev

31–40 of 118 posts

Re: PGlite – Embeddable Postgres

#31

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 Fir…

Yupp, this has big potential for local-first !

Re: PGlite – Embeddable Postgres

#32
This looks impressive. Could someone familiar with Postgres internals explain the hidden trade-offs of this approach?

I understand the obvious limitations of it being embedded/single-host, but I'm curious about the engine itself. Does running in this environment compromise standard features like ACID compliance, parallel query execution, or the ecosystem of tools/extensions we usually rely on?

Re: PGlite – Embeddable Postgres

#33
post #32

This looks impressive. Could someone familiar with Postgres internals explain the hidden trade-offs of this approach? I understand the obvious limitations of it being embedded/single-host, but I'm curious about the engine itself. Does running in this environment compromise standard features like ACID compliance, parallel query execution, or the ecosystem of tools/extensions we usually rely on?

The key limitation (at the moment) is that it only supports a single connection. W're planning to lift that limitation though.

Re: PGlite – Embeddable Postgres

#34
post #22

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 Fir…

I'm interested to use Pglite for local unit-testing, but I'm using timescaledb in prod, do you think you will have this extension pre-built for Pglite?

I’ve had incredible success with testcontainers for local unit-testing

Re: PGlite – Embeddable Postgres

#35
Really cool project! We had a situation a while back where some of our e2e tests needed the DB to be in very specific states. Technically we could have handled it with fixtures/transactions/schema resets, but doing that cleanly across a bunch of tests was pretty painful in our setup at the time

For a few edge-case scenarios we ended up mocking the DB layer (which obviously stops being a true e2e test). Something like PgLite would've been a perfect middle ground - real Postgres, zero container overhead, easy to spin up isolated instances per test, and a clean slate for every run.

Re: PGlite – Embeddable Postgres

#36
post #5

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

One use case, when doing unit tests, Docker containers, would make it too expensive with many tests. SQLite's type checking is far less strict than Postgres, which would not catch errors that would occur the real database due to type mismatch.

Having something like this, that I can quickly spawn and know, I am getting exact behavior as prod database would be a lifesaver!

Re: PGlite – Embeddable Postgres

#37
post #28
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.

Yes! I (experimentally) compiled and packaged it for react-native. Postgres on iOS and Android https://github.com/electric-sql/pglite/pull/774

Glad to see it working in react native. It always surprises me that RN doesn't natively support wasm. I've had to avoid other wasm-based libraries, like loro, for that reason.

Re: PGlite – Embeddable Postgres

#38
One thing this (and any browser-embeddable data store) are fantastic for is vibe coding interactive prototypes for user research.

AI-generated code that doesn’t need to be production ready has been a real boon to usability and design work. Testing with users something that actually saves and displays data, and seeding the app with realistic-looking datasets in both shape and size, reveals usability issues that you just don’t discover in Figma prototypes.

If a product team isn’t performing user research with interactive prototypes as a core part of their dev and design lifecycle, they’re doing themselves a real disservice. It’s so easy now.

Re: PGlite – Embeddable Postgres

#39
post #22

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 Fir…

I'm interested to use Pglite for local unit-testing, but I'm using timescaledb in prod, do you think you will have this extension pre-built for Pglite?

We have a walk-through on porting extensions to PGlite: https://pglite.dev/extensions/development#building-postgres-...

Re: PGlite – Embeddable Postgres

#40
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.

Native library is on our radar!
Post reply on HN