---
title: "Edge-compatible Serverless Driver for Postgres"
description: "Neon's @neondatabase/serverless driver lets V8-isolate platforms like Cloudflare Workers, which lack TCP, speak the real Postgres wire protocol by tunnelling it over a WebSocket to an open-source Go proxy that relays to TCP."
url: "https://swe.quest/articles/edge-compatible-serverless-driver-for-postgres-9b0d09c6c7a067d0"
canonical: "https://neon.com/blog/serverless-driver-for-postgres"
source: "Neon"
published: "2022-12-08"
difficulty: "medium"
kind: "Deep dive"
reading_minutes: 9
tags: ["postgres","serverless","networking","cryptography","webassembly"]
---

# Edge-compatible Serverless Driver for Postgres

A post on [Neon](https://swe.quest/sources/neon.md), published 2022-12-08, 9 min read, Deep dive. Original: [https://neon.com/blog/serverless-driver-for-postgres](https://neon.com/blog/serverless-driver-for-postgres)

## Summary

Neon's @neondatabase/serverless driver lets V8-isolate platforms like Cloudflare Workers, which lack TCP, speak the real Postgres wire protocol by tunnelling it over a WebSocket to an open-source Go proxy that relays to TCP. The driver is node-postgres with shims for Node APIs, and it does end-to-end TLS 1.3 via WolfSSL compiled to WebAssembly with Asyncify, offloading crypto to SubtleCrypto. Because SCRAM-SHA-256's 4,096 hash rounds exceed Workers' 10–50ms CPU limits, it falls back to cleartext auth over mandatory TLS. The post also covers latency tradeoffs from the extra proxy hop, round-trip reductions, and how to self-host the proxy for any Postgres.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [PostgreSQL](https://swe.quest/tags/postgres.md) (Data & databases)
- [Serverless](https://swe.quest/tags/serverless.md) (Backend & APIs)
- [Networking](https://swe.quest/tags/networking.md) (Infrastructure)
- [Cryptography](https://swe.quest/tags/cryptography.md) (Security)
- [WebAssembly](https://swe.quest/tags/webassembly.md) (Languages)

## Prerequisites

- PostgreSQL wire protocol basics ([easy posts on PostgreSQL](https://swe.quest/tags/postgres.md?difficulty=easy))
- WebSockets ([easy posts on Real-time systems](https://swe.quest/tags/realtime.md?difficulty=easy))
- TLS handshake basics ([easy posts on Cryptography](https://swe.quest/tags/cryptography.md?difficulty=easy))
- edge functions ([easy posts on Serverless](https://swe.quest/tags/serverless.md?difficulty=easy))

## Keywords

@neondatabase/serverless, Cloudflare Workers, node-postgres, WolfSSL, SCRAM-SHA-256, emscripten, PostGIS, Neon

## Related posts

- [Quicker serverless Postgres connections](https://swe.quest/articles/quicker-serverless-postgres-connections-7a37a1071edd4362.md): Neon · 2023-03-28 · Medium · 8 min read · PostgreSQL, Networking, Serverless, Performance engineering, Cryptography
  Neon cut the network round-trips needed to get a first query result from its WebSocket-based serverless Postgres driver from nine to four.
- [How to use Postgres at the Edge](https://swe.quest/articles/how-to-use-postgres-at-the-edge-9d5045c1101b2176.md): Neon · 2023-09-19 · Medium · 4 min read · PostgreSQL, Serverless, CDN & edge, JavaScript
  Standard Postgres can't be reached from V8-isolate edge runtimes like Vercel Edge Functions because they don't support raw TCP.
- [Sub-10ms Postgres queries for Vercel Edge Functions](https://swe.quest/articles/sub-10ms-postgres-queries-for-vercel-edge-functions-6bc9caef6fab65ca.md): Neon · 2023-07-10 · Medium · 3 min read · PostgreSQL, Serverless, CDN & edge, Performance engineering, TypeScript
  Neon's serverless Postgres driver now supports SQL-over-HTTP via fetch, and Neon's proxy adds opt-in experimental connection caching (\`fetchConnectionCache\`).
- [@neondatabase/serverless hits 1.0.0](https://swe.quest/articles/neondatabase-serverless-hits-1-0-0-d5430675bc92b751.md): Neon · 2025-03-25 · Medium · 5 min read · PostgreSQL, Serverless, TypeScript, Application security, JavaScript
  Neon's JavaScript/TypeScript serverless driver, which carries Postgres queries over HTTP and WebSockets for environments without raw TCP such as V8 isolates and browsers, reaches 1.0.0 after a refactor that adds auto-generated types via api-extractor and CI tests across Node, Bun, Deno, browsers, Cloudflare Workers, Vercel and the Prisma/Drizzle adapters.
- [Using Hyperdrive with Neon and Cloudflare Workers: FAQ](https://swe.quest/articles/using-hyperdrive-with-neon-and-cloudflare-workers-faq-3467430ed9174f03.md): Neon · 2024-12-26 · Medium · 5 min read · PostgreSQL, Serverless, CDN & edge, Caching, Performance engineering
  Cloudflare Hyperdrive is a globally distributed connection pooler and read-query cache for Workers.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
