Recommended default: Supabase PostgreSQL for the database host, with Better Auth inside the app for authentication and sessions. This is the fastest, most supported path.
The Mental Model
Here’s how the pieces fit together:- PostgreSQL + Drizzle = your data layer (schema, migrations, queries)
- Better Auth = your auth layer (sessions, sign-in, OAuth, magic links)
- Supabase = the recommended managed Postgres host
pgcrypto and pgvector will work.
Quick Setup
- Email/Password Only
- With Google OAuth
What Better Auth Handles
- Sign-in and session cookies
- Email/password accounts
- Google OAuth
- Magic link and forgot password
- Profile bootstrap via database hooks
What Drizzle Handles
- Schema definition in
lib/db/schema/* - SQL migration history in
drizzle/* - App-side database access in
lib/db/*
lib/db/schema/*, generate a new SQL migration with pnpm db:generate.
The RAG/document search features depend on the
pgvector extension. The repo enables it in drizzle/0000_better_auth_baseline.sql, so your database host must support CREATE EXTENSION vector.Can You Use Another PostgreSQL Provider?
Yes. The main requirements are:pgcryptosupportpgvectorsupport- Standard Drizzle/Postgres features used by the schema
pgvector out of the box.
Auth Helpers in the Repo
The main server-side auth helpers live inlib/auth/server.ts. Here’s the pattern:
| Helper | Use When |
|---|---|
getAuthContext() | Auth is optional |
requireUser() | Server pages and layouts |
requireApiUser() | API routes |
signOutCurrentSession() | Logout flows |
Verify It Works
Your auth and database setup is correct if you can:
- Sign in on
/auth - Reach
/ - See a profile row created for your user
- Use at least one authenticated app flow

