SYSTEM
PlanetScale Serverless driver for JavaScript¶
What it is¶
The PlanetScale Serverless driver for JavaScript (announcement post) is PlanetScale's first-party JavaScript database driver that speaks the PlanetScale HTTP API rather than the MySQL binary wire protocol. Designed for serverless / edge runtimes (Vercel Edge, Cloudflare Workers, AWS Lambda) that cannot open raw TCP sockets to speak MySQL natively.
Why it exists¶
Serverless compute platforms forbid raw TCP sockets from user code; the only egress option is HTTPS. Any database client from such a runtime therefore must speak an HTTP-based API. The Serverless driver is the consumer of the vendor-side HTTP API for the JavaScript ecosystem — the first production use case that forced the HTTP API's existence (Source: ).
Architectural properties inherited from the HTTP API¶
- Multiplexes many logical MySQL sessions over one HTTP connection — no local connection-pool state in the serverless runtime.
- TLS 1.3 0-RTT handshake available for repeat connections, saving a full round trip vs TLS 1.2.
- HTTP/2 or HTTP/3 transport — HTTP/3 when the runtime supports it (browsers + an increasing set of edge runtimes).
Status¶
Production-available; first consumer of the HTTP API. PlanetScale's benchmark post frames it as the reason the HTTP API was built.
Why it shows up on this wiki¶
First canonical wiki example of a vendor-shipped serverless database driver that's HTTP-only by construction — the functional opposite of a traditional binary-protocol driver with local pool management, and the production answer to the serverless-TCP-socket-restriction forcing function.
Seen in¶
- — canonical launch post (Taylor Barnett + Matt
Robenolt, 2022-08-18). Announces the driver as shipping
npm package
@planetscale/database, targeting Cloudflare Workers, Vercel Edge Functions, and Netlify Edge Functions. Frames four structural wins from HTTP transport: TLS 1.3 connections, HTTP/2 connection multiplexing, gzip/brotli/snappy compression, and CDN-like global routing. Claims "100ms or more" latency reduction on US West → US East connections via the global routing layer. Demo repof1-championship-statscovers all three runtimes × one database. SQL sanitisation against injection is a first-class driver responsibility. - — referenced as the first production consumer of the HTTP API: "This HTTP interface led to the development of our Serverless driver for JavaScript and PlanetScale Connect." (Link in source.) 2023-01-04 benchmark post quantifies the cold-start win this driver inherits (~4.6× on high-latency networks).
Related¶
- systems/planetscale
- systems/planetscale-http-api
- systems/planetscale-global-network
- systems/mysql
- systems/cloudflare-workers
- systems/vercel-edge-functions
- systems/netlify-edge-functions
- concepts/serverless-tcp-socket-restriction
- concepts/http-3
- concepts/cold-start-connection-cost
- concepts/connection-multiplexing-over-http
- concepts/tls-1-3-zero-rtt-handshake
- patterns/http-api-alongside-binary-protocol
- patterns/multiplex-many-database-connections-over-one-http-connection
- patterns/cdn-like-database-connectivity-layer
- companies/planetscale