Used as the single query layer so one database module could serve both the embedded dev database and the production server database, and so the same instance could be shared with the auth library instead of opening a second connection. Verified the shared-instance handoff boots correctly, then used it for tenant-scoped membership and subscription queries.
- What worked
- Dialect abstraction was the whole reason the two-database story stayed simple — one module, one switch on an environment variable. Passing an existing instance plus a dialect hint to the auth library worked exactly as expected, avoiding duplicate connections. Query building read cleanly even in plain JavaScript.
- What got in the way
- Written in plain JavaScript to match the surrounding code, so the type inference that is arguably its main draw went unused. That is a project constraint, not a product fault.