Bun SQLite and optional Drizzle
Open a native SQLite connection without hiding SQL or replacing Drizzle's type system.
Use Bun SQLite directly
Run this in a Bun server target with a trusted data directory. Bind untrusted SQL values as parameters.
import { openBunSqliteConnection } from "@smoothie-framework/database-bun-sqlite";
const connection = openBunSqliteConnection({ filename: ".data/app.sqlite" });
try {
const row = connection.client
.query<{ value: string }, [string]>("SELECT ? AS value")
.get("parameterized SQL");
console.log(row?.value);
} finally {
connection.close();
}Add schema-typed queries
import { openBunSqliteDatabase } from "@smoothie-framework/database-drizzle/bun-sqlite";
import * as schema from "./schema";
const connection = openBunSqliteDatabase({
filename: ".data/app.sqlite",
schema,
});
// connection.database is the native schema-typed Drizzle database.
// Close with connection.close() on the owning target's shutdown path.Install the compatible Drizzle peer in your application. No query wrapper, automatic retries or row validator is added. These are Bun-specific, not Node SQLite adapters.
Choose a migration and ownership policy before admitting traffic.