Documentation
PostgreSQL
Vercel Postgres

Vercel Postgres

According to their official website (opens in a new tab), Vercel Postgres is a is a serverless SQL database designed to integrate with Vercel Functions.

Drizzle ORM natively supports both @vercel/postgres (opens in a new tab) serverless driver with drizzle-orm/vercel-postgres package and postgres or pg drivers to access Vercel Postgres through postgesql://

Checkout official Vercel Postgres + Drizzle (opens in a new tab) docs

Install dependencies

npm i drizzle-orm @vercel/postgres 
npm i -D drizzle-kit 

Prepare Vercel Postgres

Setup project according to their official docs (opens in a new tab)

Make your first query

index.ts
import { sql } from '@vercel/postgres';
import { drizzle } from 'drizzle-orm/vercel-postgres';
 
const db = drizzle(sql)
const result = await db.select().from(...);

With @vercel/postgres (opens in a new tab) 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 environments - you can do it either with @vercel/postgres package or access database through postgesql:// protocol with either postgres or pg