Description
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.
- https://neon.tech/docs/serverless/serverless-driver
- https://github.com/neondatabase/serverless
- https://neon.tech/blog/quicker-serverless-postgres
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.