Drizzle + Lakebase in an Off-Platform App
Connect Drizzle ORM to Lakebase with pg password callbacks and migration-time temporary DATABASE_URL credentials.

Build with AI
- Copy the prompt below
- Paste into Cursor, Claude Code, Codex, or any coding agent
- Your agent builds it — asking questions along the way so the result is exactly what you want
New to templates? Learn more here
When done, you will have:
- A Lakebase-backed connection pool with automatic token refresh via password callback
- Drizzle ORM initialized with your schema and ready for type-safe queries
- A migration script that builds a temporary connection URL with fresh Lakebase credentials
- A working Drizzle Kit configuration for schema generation and migrations
Prerequisites
This template connects an off-platform Node.js app (e.g. AWS, Vercel, Netlify) to Lakebase Postgres. Verify these Databricks workspace features are enabled before starting.
- Lakebase Postgres available. Run
databricks postgres list-projects --profile <PROFILE>and confirm the command succeeds. Anot enablederror means Lakebase is not available to this identity. - A provisioned Lakebase project. Complete the Create a Lakebase Instance template first so you have an endpoint host, database, and endpoint resource path available as
PGHOST,PGDATABASE, andLAKEBASE_ENDPOINT. - An env management setup for off-platform auth. Complete the Lakebase Env Management for Off-Platform Apps and Lakebase Token Management templates first — this template imports
envandgetLakebasePostgresTokenfrom those modules.


