better-sqlite3 recipes
9 tested better-sqlite3 integration recipes with Zod, Drizzle ORM, SQLite, drizzle-zod. Exact pinned versions and a last-passed receipt, last run 2026-10-15.
better-sqlite3 transactions with Zod-validated inputs
A small ledger on better-sqlite3 using db.transaction for atomic transfers, nested transactions as savepoints for all-or-nothing batches, and Zod 4 to validate inputs and rows, tested on in-memory SQLite.
Drizzle ORM + better-sqlite3 CRUD
Typed schema, migrations-free table creation and CRUD with Drizzle on an in-memory SQLite database.
Drizzle ORM + drizzle-zod validated inserts on SQLite
Generate Zod insert and select schemas from Drizzle tables with drizzle-zod, refine them, and validate input before inserting into SQLite.
Hono + Drizzle ORM + SQLite REST API (Vitest)
CRUD REST API in Hono backed by Drizzle ORM on better-sqlite3, with Zod validation, tested with Vitest and app.request().
Knex migrations, seeds and queries on better-sqlite3
Knex 3 with the better-sqlite3 client: in-code migrations via a custom migrationSource (latest, down, rollback, list), foreign keys enabled per connection, a transactional seed and a join plus aggregate query, tested on in-memory SQLite.
Kysely + better-sqlite3 typed queries
Type-safe SQL with Kysely on SQLite, including a schema migration, joins and a transaction.
NestJS 12 + TypeORM 1 on in-memory SQLite, tested with @nestjs/testing
A NestJS module with a TypeORM entity, repository-backed service and controller, wired to in-memory SQLite and tested end to end through the Nest app with supertest. better-sqlite3 stays on 12.x because TypeORM 1.1 peers on ^12.
Prisma 7 + SQLite via better-sqlite3 adapter
Prisma Client 7 with the better-sqlite3 driver adapter, schema push and relational queries on a local SQLite file.
Prisma 7 + SQLite: nested writes, interactive transactions and unique errors
Prisma Client 7 on SQLite (better-sqlite3 adapter): nested creates, an interactive $transaction that rolls back, and handling P2002 unique-constraint errors.
Used together with better-sqlite3
ZodDrizzle ORMSQLitedrizzle-zodHono@hono/zod-validatorvitestknexKysely@nestjs/core@nestjs/typeormtypeormPrisma