@coderbuzz/sql
v0.9.6
Published
Runtime-agnostic TypeScript SQL toolkit for Bun, Node.js, and Deno with typed schemas, dialect-aware builders, engine adapters, migrations, and batch inserts.
Maintainers
Readme
@coderbuzz/sql
The un-opinionated SQL toolkit for TypeScript. Schema-driven, multi-dialect, runtime agnostic, no ORM lock-in.
5 databases: SQLite, PostgreSQL, MySQL, MSSQL, ClickHouse. One API. Full type safety.
Why @coderbuzz/sql?
- ClickHouse built in: Drizzle and Kysely don't cover it
- No ORM magic: you write SQL with type-safe builders, tagged templates, and full dialect awareness
- Real transactions: one connection per transaction, with savepoints, isolation levels,
FOR UPDATE, andSET LOCALsetup for row-level security - Exact money:
decimal/numeric/bigintare typedstring, so cents survive the round trip, withBigInt-backed arithmetic (add,multiply,allocate, rounding modes) in@coderbuzz/sql/decimal - Built-in batcher: debounce, timeout, and backpressure, with mandatory error reporting so a failed flush never loses rows quietly
- Schema migration utilities: introspect, diff, generate ALTER TABLE, no CLI
- Middleware pipeline:
db.use()for logging, tracing, safety guards, inside transactions too - <30 KB gzip: tree-shakeable, zero runtime overhead vs hand-written SQL
Installation
npm install @coderbuzz/sqlPlus a driver (pg, mysql2, mssql, better-sqlite3). On Bun, SQLite, PostgreSQL (@coderbuzz/sql/postgres-bun) and MySQL (@coderbuzz/sql/mysql-bun) need no driver.
Quick Start
import { sqlite } from "@coderbuzz/sql/sqlite";
const db = sqlite.connect({ path: ":memory:" });
const users = sqlite.table("users", {
id: sqlite.integer().primaryKey(),
email: sqlite.text().notNull().unique(),
name: sqlite.text().notNull(),
});
await db.migrate(users);
const rows = await users.from(db)
.fields("id", "email", "name")
.where(sqlite.eq("active", true))
.order_by("id DESC")
.limit(10)
.execute();
db.close();Documentation
Full API reference and dialect guides: DOCS.md
License
MIT © 2026 Indra Gunawan
