According to their official website, Neon is a fully managed serverless Postgres.
Drizzle ORM natively supports both the Neon serverless driver
with the drizzle-orm/neon-serverless package and the postgres or pg drivers for accessing a Neon Postgres database.
npm
yarn
pnpm
bun
With the Neon serverless driver [github, Neon docs],
you can access a Neon database from serverless environments over HTTP or WebSockets instead of TCP.
Querying over HTTP is faster for single, non-interactive transactions. If you require session or interactive transaction support or a fully-compatible drop-in replacement for the pg driver, use WebSockets.
HTTP
WebSockets
For an example of using Drizzle ORM with the Neon Serverless driver in a Cloudflare Worker, see here.
To use Neon from a serverfull environment, you can use the PostgresJS driver, as described in Neon’s official nodejs docs — see docs.
Xata
According their official website, Xata is a Postgres data platform with a focus on reliability, scalability, and developer experience. The Xata Postgres service is currently in beta, please see the Xata docs on how to enable it in your account.
Drizzle ORM natively supports both the xata driver with drizzle-orm/xata package and the postgres or pg drivers for accessing a Xata Postgres database.
npm
yarn
pnpm
bun
You can use Drizzle with Xata with a HTTP client or a TCP client. The HTTP client doesn’t create a persistent connection to the Xata server, while the TCP client does and can be used for better performance with a higher number of requests. The HTTP client is usually recommended from serverless environments like Cloudflare Workers or Vercel Edge Functions. The TCP client is typically used from long-running servers like Express.js or Fastify.
The following example use the Xata generated client, which you obtain by running the xata init CLI command.
HTTP
TCP
TCP (pool)
If you prefer to not use the generated Xata client, it is also possible to use Xata with the postgres or pg drivers, in this case you can copy the connection string from the Settings page of your Xata database. For example:
For more details about using Drizzle with Xata, see the official Xata docs.
PGlite
According to the official repo, PGlite is a WASM Postgres build packaged into a TypeScript client library that enables you to run Postgres in the browser, Node.js and Bun, with no need to install any other dependencies. It is only 2.6mb gzipped.
It can be used as an ephemeral in-memory database, or with persistence either to the file system (Node/Bun) or indexedDB (Browser).
Unlike previous “Postgres in the browser” projects, PGlite does not use a Linux virtual machine - it is simply Postgres in WASM.
npm
yarn
pnpm
bun
Postgres.JS
According to the official website, PostgresJS is the fastest fully featured PostgreSQL client for Node.js and Deno.
Drizzle ORM natively supports postgresjs driver with drizzle-orm/postgres-js package.
npm
yarn
pnpm
bun
⚙️
For the built in migrate function with DDL migrations we strongly encourage you to use max: 1 connection configuration.
For querying purposes feel free to use pool size of your choice based on your business demands.
node-postgres
According to the official website, node-postgres is a collection
of Node.js modules for interfacing with your PostgreSQL database.
Drizzle ORM natively supports pg with drizzle-orm/pg package.
npm
yarn
pnpm
bun
You can connect to a PostgreSQL database either using a single client connection or a pool.
Client connection
Pool connection
Usage with Cloudflare Workers
Now that Cloudflare Workers supports TCP connections, you can usenode-postgres to connect to connection poolers, e.g. pgBouncer.
⚙️
For the built in migrate function with DDL migrations we strongly encourage you to use max: 1 connection configuration.
For querying purposes feel free to use pool size of your choice based on your business demands.
Vercel Postgres
According to their official website,
Vercel Postgres is a serverless SQL database designed to integrate with Vercel Functions.
Drizzle ORM natively supports both @vercel/postgres serverless
driver with drizzle-orm/vercel-postgres package and postgres or pg
drivers to access Vercel Postgres through postgesql://
With @vercel/postgres severless package
you can access Vercel Postgres from either serverful or serverless environments with no TCP available,
like Cloudflare Workers, through websockets.
If you’re about to use Vercel Postgres from a serverfull environment, you can do it
either with @vercel/postgres or directly access the DB through postgesql:// with
either postgres or pg.
Supabase
According to the official website, Supabase is an open source Firebase alternative for building secure and performant Postgres backends with minimal configuration.
If you decide to use connection pooling via Supabase (described here), and have “Transaction” pool mode enabled, then ensure to turn off prepare, as prepared statements are not supported.
Connect to your database using the Connection Pooler for serverless environments, and the Direct Connection for long-running servers.
AWS Data API
Drizzle ORM natively supports aws-sdk driver with drizzle-orm/aws-data-api package.