Skip to content
bun:sqlite/ prisma adapter

Introduction

prisma-sqlite-bun-adapter lets Prisma 7 talk to SQLite through the driver Bun already ships, bun:sqlite.

Why this exists

Prisma 7 requires a driver adapter for every datasource — the Rust query engine is gone, and the adapter is how the client reaches the database. Both official SQLite adapters depend on native modules that Bun cannot load:

  • @prisma/adapter-better-sqlite3 depends on better-sqlite3, which Bun rejects outright rather than failing to compile. There is no workaround.
  • @prisma/adapter-libsql depends on native libSQL bindings.

Bun ships a complete SQLite driver in its standard library. This package adapts it to Prisma’s driver-adapter interface, so there is nothing to compile, no native dependency, and no postinstall step.

What you get

  • Runtime queries through PrismaClient, including transactions and savepoints.
  • Prepared-statement caching per connection, which the official adapter does not do.
  • SQLite extended result codes surfaced as typed Prisma errors.
  • Opt-in PRAGMA defaults, including foreign_keys, which SQLite leaves off.
  • One runtime dependency (@prisma/driver-adapter-utils) and no native code.

Requirements

Bun≥ 1.2.17
@prisma/client7.x

The Bun floor is not arbitrary. Statement.declaredTypes landed in 1.2.17, and the adapter cannot map SQLite column types to Prisma column types without it.

How it is tested

Correctness is measured against the official adapter rather than asserted. A shared corpus of queries runs through both this adapter and @prisma/adapter-better-sqlite3, and the full result sets are compared — column names, column types, and row values.

Because Bun refuses to load better-sqlite3 at all, the two cannot run in the same process. The reference side runs under Node and writes a committed fixture; CI regenerates it and fails on drift, so it cannot quietly decay into a snapshot of this adapter’s own behaviour.

Three deliberate divergences remain, each documented in Differences from the official adapter. One of them is a bug in the official adapter that this suite found and that has been reported upstream.