gajus / slonik

A Node.js PostgreSQL client with runtime and build time type safety, and composable SQL.
Other
4.55k stars 139 forks source link

slonik support @neondatabase/serverless (postgres over HTTP / websockets) - pg compatible #642

Open firxworx opened 3 weeks ago

firxworx commented 3 weeks ago

Desired Behavior

Slonik project offers official guidance in docs and/or a bridge/adapter to @neondatabase/serverless which, like slonik, is based on pg and intended to serve as a drop-in replacement.

This would enable use of slonik in serverless/edge environments to connect to postgres over HTTP or websockets and take advantage over various performance and scalability benefits in this deployment context.

Motivation

Honestly I think it seems like a good fit and future forward step for Slonik -- it opens the door to more applications, larger community, broader and more varied ecosystem with wider range of expertise.

I wonder if you reach out to the right people at Neon they may even sponsor this :)

Serverless/edge type environments aren't going anywhere. New breed devs are brought up on CloudFlare, Vercel, Netlify and others, plus AWS is going to be a rock for the foreseeable future not to mention Azure + Google. Neon is frequently suggested as the way to go for serverless/edge + postgres.

Neon is an innovator (e.g. branching) and a lot of their developments are open source so they will only influence more in the foreseeable future.

Other popular database libraries for Node / TypeScript already have official adapters for Neon serverless including Drizzle.

If you haven't tried Neon I'd suggest trying their generous free tier.

Implementation

Slonik already has a bridge/adapter for postgres.js which has way more differences and nuances than something based on pg and intended to be drop-in.

gajus commented 1 day ago

This would belong in community packages.

I will leave this issue open in case anyone wants to contribute a bridge. I will add it to Slonik's README.