Skip to content

feat(database): server runtime — drizzle pool, OBO, transactions, hooks#355

Draft
ditadi wants to merge 12 commits intostack/database/foundationfrom
stack/database/server
Draft

feat(database): server runtime — drizzle pool, OBO, transactions, hooks#355
ditadi wants to merge 12 commits intostack/database/foundationfrom
stack/database/server

Conversation

@ditadi
Copy link
Copy Markdown
Contributor

@ditadi ditadi commented May 6, 2026

🥞 Stacked PR

Use this link to review incremental changes.


Server-side runtime for the database plugin. Moves the entity API onto a Drizzle-backed Postgres pool and adds the multi-tenant execution primitives.

Drizzle-backed entity runtime

Switches entity operations from the Data API to a Drizzle/Postgres pool, adds typed coercion, health checks, route hardening, and PostgREST-style include/upsert semantics.

OBO, transactions, and SQL escape hatch

Adds appkit.database.transaction(fn), tagged sql execution, and asUser(req) execution scoped to the caller. Per-user OBO pools set app.user_id on connection for RLS-aware queries.

Safety and shutdown

Hides private columns from default reads and routes, drains evicted user pools, caps toArray(), scrubs route errors, and tightens pool fan-out.

Test plan

  • Entity route tests
  • Hook tests
  • OBO pool scoping tests
  • Transaction and SQL tests
  • Full stack verification run locally before push

PR Stack

  1. Database foundation: schema builder, plugin skeleton, runtime base — feat(database): foundation — schema builder, plugin skeleton, connectors #354
  2. Server runtime: Drizzle pool, OBO, transactions, hooks (this PR)
  3. Brownfield support: introspector, drift detection, db CLI — feat(database): brownfield support — introspector, drift detection, db CLI #356
  4. appkit db init onboarding — feat(cli): appkit db init — one-command lakebase onboarding #357
  5. Typed browser db client + dev playground demo — feat(database): typed browser db client + dev playground demo #358
  6. React entity UI + columns metadata — feat(database): React entity UI components + columns metadata route #359
  7. RLS scaffolder + connection pool tuning — feat(database): RLS scaffolder + connection pool tuning #360
  8. Database plugin guide + release polish — docs(database): plugin guide + CLAUDE.md polish + small public-API tweaks #361

@ditadi ditadi force-pushed the stack/database/server branch from 3d25e45 to caa5080 Compare May 7, 2026 01:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant