The HTTP Bridge to PostgreSQL for Serverless & Edge

Run PostgreSQL queries over standard stateless HTTPS fetch() without driver dependencies. Keep reusable connection pools alive, enforce least-privilege role scopes, and execute atomic multi-statement transactions with full idempotency guarantees.

Engineered for Modern Cloud & Edge Architectures

Solve direct database connection limits and distributed secret exposure with a secure, long-running gateway process.
    Stateless fetch() API
    Connect from Cloudflare Workers, Vercel, AWS Lambda, Deno, or Bun using standard HTTPS and JSON. Zero TCP socket requirements or native driver binaries.
    Persistent Connection Pools
    Prewarm and reuse backend PostgreSQL sessions across thousands of ephemeral serverless invocations with automatic verification and DISCARD ALL resets.
    Role-Based Least Privilege
    Map API keys directly to dynamic PostgreSQL roles with granular database and table-level CRUD permissions (c, r, u, d). PostgreSQL enforces authorization.
    Atomic Transactions
    Submit multi-statement batches with Idempotency-Key headers, configurable isolation levels, and deferred status polling to prevent accidental duplicate writes.
    Asynchronous Query Offload
    Offload long-running queries beyond invocation deadlines with durable status tracking, 5-minute statement timeouts, and non-blocking polling.
    Observability & Rate Limiting
    Redis-backed distributed rate limits, worker-thread SQLite analytics, and automatic failed-SQL literal sanitization for production security.

Quick Integration

Execute queries from any serverless environment using standard fetch() in just a few lines of code.

// Minimal serverless client with timeout handling export async function queryPostgres(sql: string, params: unknown[] = []) { const res = await fetch(`${process.env.PG_GATEWAY_URL}/query`, { method: 'POST', headers: { 'content-type': 'application/json', 'x-api-key': process.env.PG_GATEWAY_API_KEY!, 'x-database': process.env.PG_GATEWAY_DATABASE!, }, body: JSON.stringify({ query: sql, parameters: params }), }) const payload = await res.json() if (!res.ok) throw new Error(payload.error?.code ?? `HTTP_${res.status}`) return payload.data }
Copyright © 2026