Home

boring / v2

publicBoring-Software-Inc/v2
Overview Code History Branches Pull requestsIssuesInsights Campfire Docs
main
HomeOverview Code PRsIssues

feat: bun run dev:demo — embedded pglite, web head only (§13)

4 months ago

732e270
Authored
grim7/13/2026, 7:32:09 AM
one command serves a fully seeded, presentable app — the WEB HEAD ONLY
(no docker, no worker, no api, no queue). a demo never processes a
webhook; it looks at a dashboard with a story in it.

- database is embedded PGlite (in-process WASM postgres) at .demo/,
  running the SAME drizzle schema and SAME generated migrations as prod.
  one dialect, no drift — sqlite was rejected because it would fork the
  read path (lateral query, jsonb, timestamptz) for no benefit pglite
  doesn't already give.
- createPgliteDb + applyPgliteMigrations land in @tripwire/db; getDb()
  branches on PGLITE_DATA_DIR between the pglite instance and the pg
  pool. the shared Db type stays single-driver via one documented cast.
- no queue in demo, so the lone write needing pg-boss (approve/deny)
  degrades to a worker-free markModerationDecided; a stub pool throws
  loudly if anything else reaches for .pool.
- @electric-sql/pglite is hoisted at the ROOT: it's drizzle-orm's
  optional peer, so declaring it per-package forked drizzle into a
  second variant and broke web↔db type identity. one root declaration
  collapses it back to a single drizzle instance.
- the script seeds the story (owning the single-connection pglite dir),
  closes, then spawns vite pointed at the same dir with a fixed dev
  BETTER_AUTH_SECRET so the gates + persona switcher work.

readme documents the command; .demo/ is gitignored. new test: prod
migrations + services + the worker-free decision path all run on pglite.
checks: typecheck all, biome, boundaries, 216 tests.

Parent26c2dfb

13 files changed
  • .gitignore+1−0
  • DECISIONS.md+38−0
  • README.md+46−0
  • all-summaries.md+20−0
  • apps/web/src/lib/moderation-queue.functions.ts+11−1
  • apps/web/src/lib/server/db.ts+39−3
  • bun.lock+5−0
  • package.json+4−0
packages/db/src/index.ts
+5
−0
  • packages/db/src/pglite.integration.test.ts+60−0
  • packages/db/src/pglite.ts+44−0
  • packages/db/src/services/moderation.ts+30−0
  • scripts/dev-demo.ts+62−0