Skip to content

TIP

This page mirrors packages/db/README.md from the repository. Edit it at the source, not here.

@saasweave/db

PostgreSQL access via Drizzle ORM: schema, migrations, and query helpers.

Schema areas

DomainTables / notes
Authusers, sessions, orgs, members, invitations (Better Auth)
Platformplatform_settings, feature_flag, audit
Billingsubscriptions, usage records
API keyshashed secrets, metadata
Notificationsin-app feed
Webhookswebhook_endpoint, webhook_delivery
Mediamedia_asset
SSOsso_provider
2FAtwo_factor

Always on

  • migrateDatabase() — runs on server startup
  • db client (connection pool)
  • Audit recording helpers
  • Webhook target queries

Scripts

bash
vp run db:migrate      # apply migrations
vp run db:generate     # new migration from schema
vp run db:studio       # Drizzle Studio
vp run db:dev:start    # local Postgres only (docker-compose.dev.yaml)

Environment variables

VariableRequired
DATABASE_URLYes

Tests

bash
pnpm --filter @saasweave/db test:unit

Released under the MIT License.