Skip to content

Allow framework to boot without a database (HQ-30)#4

Closed
kobeindemans wants to merge 1 commit into
mainfrom
kobe/hq-30-framework-db-skip-guard
Closed

Allow framework to boot without a database (HQ-30)#4
kobeindemans wants to merge 1 commit into
mainfrom
kobe/hq-30-framework-db-skip-guard

Conversation

@kobeindemans

Copy link
Copy Markdown
Contributor

What

  • Make the db connection pool lazy (behind a Proxy) so import { db } no longer requires DATABASE_URL at module load.
  • Gate migrateAllApps behind SKIP_MIGRATIONS=true.

Why

Prerequisite for the API-only customer portal (HQ-30). The portal is a separate deployment that holds no database and talks to HQ over HTTP. Today the framework throws at boot if DATABASE_URL is unset (db/index.ts top-level check, reached via migrateAllAppsdb import). This change lets a deployment run the framework with no DB of its own.

Behaviour

  • DATABASE_URL set (HQ, all existing deploys): unchanged — pool created on first db access.
  • SKIP_MIGRATIONS=true + no DATABASE_URL (portal): boots fine; never touches the DB.
  • No DATABASE_URL but db actually used: still throws the original clear error, just on first access instead of at import.

Verification

  • bun run tsc --noEmit in packages/framework: clean.
  • Importing db with empty DATABASE_URL succeeds; calling db.select() throws DATABASE_URL is not set.

🤖 Generated with Claude Code

Make the db connection pool lazy (behind a Proxy) so importing `db` no
longer requires DATABASE_URL at module load, and gate migrateAllApps
behind SKIP_MIGRATIONS=true. This lets the customer-facing portal
deployment run the framework with no database of its own (HQ-30).

The DATABASE_URL check now fires on first real db access, so existing
consumers are unchanged and a genuine misconfiguration still throws.
@kobeindemans kobeindemans deleted the kobe/hq-30-framework-db-skip-guard branch June 4, 2026 21:46
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