r/postgres • u/Savings-Feedback6581 • 2d ago
Tools Self-hosted alternative to Neon's HTTP driver: query your own Postgres via fetch()
Connecting serverless and edge functions to self-hosted PostgreSQL can be tricky. Some runtimes have TCP limitations, and opening database connections on every invocation adds overhead.
Neon offers an HTTP driver for its platform, so I built HTTP PostgreSQL Gateway for self-hosted PostgreSQL.
It runs alongside your database and lets you query it using plain fetch().
- Persistent PostgreSQL connection pooling
- Scoped API keys mapped to PostgreSQL roles
- Async queries for long-running operations, so functions don't have to wait for results
- Atomic batches and transactions
It doesn't replace PostgreSQL or make queries faster. It handles connections and execution outside your serverless functions.
Security: It accepts client-supplied SQL, so use least-privilege roles and restrict network access. The project is new and hasn't had much external review yet.
Repo: https://github.com/http-postgres/http-postgres
How are you connecting self-hosted PostgreSQL to serverless or edge functions today? Feedback welcome.
2
u/ivomitkittens 1d ago
What do you mean Cloudflare Workers can’t open TCP connections? https://developers.cloudflare.com/workers/tutorials/postgres/