Skip to content
fusion-db

fusion-db

Drizzle schema and Postgres client for the Fusion stack. It ships the reusable foundation schema (Better Auth's user / session / account / verification, plus a mailbox, audit log, runtime config and API tokens) together with a server-only Drizzle client.

The package is source-published (Model A): consumers bundle the TypeScript directly.

Install

Published to GitHub Packages under the @tikab-interactive scope, so an .npmrc with a read:packages token is required:

.npmrc
@tikab-interactive:registry=https://npm.pkg.github.com
//npm.pkg.github.com/:_authToken=${NPM_TOKEN}
bun add @tikab-interactive/fusion-db drizzle-orm pg

drizzle-orm and pg are peer dependencies — install them in the consuming app.

Server-only by design

The package exposes two export conditions. Server bundles get the real pg-backed client; browser bundles resolve to a stub that throws on access — so the pg driver never reaches the client:

Loading diagram...

Use it from a server function or route loader:

import { db, user } from "@tikab-interactive/fusion-db";
 
const users = await db.select().from(user);

Subpath exports

ImportContents
@tikab-interactive/fusion-dbdb client + the full composed schema
@tikab-interactive/fusion-db/schemacomposed schema (foundation + app)
@tikab-interactive/fusion-db/foundationfoundation tables only

Next up: the schema and the client.