import { getDbClient, getReadDbClient } from "@toolctrl/db/client.server"; const db = getDbClient(); /** * Read-replica accessor for hot-read paths (CRM/KB listings, dashboards, * public sites/portals, analytics aggregations). Falls back to the write * singleton when `DATABASE_READ_URL` is unset, so single-DB dev / self- * hosted setups keep working unchanged. Do NOT use right after a write * inside the same request — replication is eventually consistent. * * See `docs/architecture/rw-split.md` for the convention table and the * read-after-write hazard discussion. */ const dbRead = getReadDbClient(); export { db, dbRead };