Set up database connections with typed query clients, migrations, and connection pooling. Supports SQL databases, edge-compatible drivers, and managed platforms.
Full-featured relational database with Drizzle ORM
DATABASE_URLLightweight embedded database for local-first applications
Edge-hosted SQLite with libSQL replication and global distribution
TURSO_DATABASE_URLTURSO_AUTH_TOKENManaged PostgreSQL with real-time subscriptions, auth, and storage
SUPABASE_URLSUPABASE_ANON_KEYQuery with Drizzle
Type-safe database queries using the generated client
import { db } from '@/lib/db'
import { users } from '@/lib/db/schema'
import { eq } from 'drizzle-orm'
const user = await db.query.users.findFirst({
where: eq(users.email, '[email protected]'),
with: { posts: true },
})Add database to your Primstack project with a single command:
prim db init