{"id":45826,"library":"prisma-adapter-bun-sqlite","title":"Prisma adapter for Bun SQLite","description":"prisma-adapter-bun-sqlite v0.8.0 is a Prisma driver adapter for Bun's native SQLite (bun:sqlite). It requires Bun >=1.3.0 and @prisma/client ^7.0.0, ships TypeScript types, and has zero dependencies beyond Bun. It supports WAL mode, safe integers, timestamp format options (iso8601/unixepoch-ms), programmatic migrations, and is designed for single-binary deployment with `bun build --compile`. Unlike alternatives (libsql, better-sqlite3), it uses Bun's native SQLite, is fully tested with 154 tests including 39 from Prisma's official suite, and provides proper error mapping to Prisma error codes (P2002, P2003, etc.). Release cadence: active development with frequent releases.","status":"active","version":"0.8.0","language":"javascript","source_language":"en","source_url":"https://github.com/mmvsk/prisma-adapter-bun-sqlite","tags":["javascript","prisma","adapter","driver-adapter","bun","sqlite","bun-sqlite","database","orm","typescript"],"install":[{"cmd":"npm install prisma-adapter-bun-sqlite","lang":"bash","label":"npm"},{"cmd":"yarn add prisma-adapter-bun-sqlite","lang":"bash","label":"yarn"},{"cmd":"pnpm add prisma-adapter-bun-sqlite","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency required to use the PrismaClient constructor with adapter","package":"@prisma/client","optional":false}],"imports":[{"note":"Named export only; default import is not supported.","wrong":"import PrismaBunSqlite from 'prisma-adapter-bun-sqlite'","symbol":"PrismaBunSqlite","correct":"import { PrismaBunSqlite } from 'prisma-adapter-bun-sqlite'"},{"note":"In Prisma 7+, PrismaClient must be imported from the generated output path, not from @prisma/client. The generated path is specified by the `output` field in schema.prisma.","wrong":"import { PrismaClient } from '@prisma/client'","symbol":"PrismaClient","correct":"import { PrismaClient } from './path/to/generated/client'"},{"note":"Constructor expects an options object, not a string. Also `wal` was added in v0.8.0.","wrong":"const adapter = new PrismaBunSqlite('file:./db.sqlite')","symbol":"PrismaBunSqlite options","correct":"const adapter = new PrismaBunSqlite({ url: 'file:./db.sqlite', wal: { enabled: true } })"}],"quickstart":{"code":"// prisma/schema.prisma\n// generator client {\n//   provider   = \"prisma-client\"\n//   engineType = \"client\"\n//   runtime    = \"bun\"\n//   output     = \"./generated\"\n// }\n// datasource db {\n//   provider = \"sqlite\"\n// }\n\nimport { PrismaClient } from './path/to/prisma/generated/client';\nimport { PrismaBunSqlite } from 'prisma-adapter-bun-sqlite';\n\nconst adapter = new PrismaBunSqlite({ url: 'file:./db.sqlite', safeIntegers: true });\nconst prisma = new PrismaClient({ adapter });\n\n// Example: create and query users\nawait prisma.user.create({ data: { name: 'Alice', email: 'alice@example.com' } });\nconst users = await prisma.user.findMany();\nconsole.log(users);\n\n// Programmatic migration (optional)\nimport { migrate } from 'prisma-adapter-bun-sqlite';\nawait migrate({ migrationsPath: './prisma/migrations' });","lang":"typescript","description":"Shows basic setup: import PrismaBunSqlite and generated PrismaClient, instantiate adapter with url, create PrismaClient, perform CRUD, and optionally run programmatic migrations."},"warnings":[{"fix":"Use `new PrismaBunSqlite({ url: 'file:./db.sqlite' })` instead of `new PrismaBunSqlite('file:./db.sqlite')`.","message":"PrismaBunSqlite constructor now expects an options object (not a string).","severity":"breaking","affected_versions":">=0.8.0"},{"fix":"Remove `maxBoundLength`; not needed in v0.8.0.","message":"The `maxBoundLength` option from earlier versions is removed.","severity":"deprecated","affected_versions":"<0.8.0"},{"fix":"Update schema.prisma to set `output` and import from that path (e.g., './prisma/generated/client').","message":"PrismaClient must be imported from the generated output path, not from '@prisma/client'. Using `@prisma/client` directly leads to missing adapter support.","severity":"gotcha","affected_versions":">=7.0.0"},{"fix":"Use a file-based URL for persistent storage.","message":"If using `:memory:` database, data is lost when connection closes.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Update Bun to version 1.3.0 or later.","message":"Requires Bun >=1.3.0. Older Bun versions will throw a compatibility error.","severity":"breaking","affected_versions":">=0.8.0"},{"fix":"Use `synchronous: 'FULL'` or omit WAL for maximum safety; WAL with `NORMAL` is faster but less durable.","message":"The `wal` option with `synced: false` might cause data loss on crash.","severity":"gotcha","affected_versions":">=0.8.0"}],"env_vars":null,"search_vec":"'1.3.0':27 '154':80 '39':83 '7.0.0':30 'activ':103 'adapt':2,8,16,110,113 'altern':65 'better':68 'better-sqlite3':67 'beyond':38 'binari':58 'build':62 'bun':4,9,18,22,26,39,61,72,114,117 'bun-sqlit':116 'cadenc':102 'code':97 'compil':63 'databas':119 'depend':37 'deploy':59 'design':54 'develop':104 'driver':15,112 'driver-adapt':111 'error':92,96 'etc':100 'format':47 'frequent':106 'fulli':77 'includ':82 'integ':45 'iso8601/unixepoch-ms':49 'javascript':108 'libsql':66 'map':93 'migrat':51 'mode':43 'nativ':20,74 'offici':87 'option':48 'orm':120 'p2002':98 'p2003':99 'prisma':1,7,14,85,95,109 'prisma-adapter-bun-sqlit':6 'prisma/client':29 'programmat':50 'proper':91 'provid':90 'releas':101,107 'requir':25 'safe':44 'ship':31 'singl':57 'single-binari':56 'sqlite':5,10,21,23,75,115,118 'sqlite3':69 'suit':88 'support':41 'test':78,81 'timestamp':46 'type':33 'typescript':32,121 'unlik':64 'use':71 'v0.8.0':11 'wal':42 'zero':36","created_at":"2026-06-07T12:56:55.239205+00:00","updated_at":"2026-06-07T12:56:55.239205+00:00","problems":[{"fix":"Run `bun add prisma-adapter-bun-sqlite` and ensure Bun >=1.3.0.","cause":"Package not installed or Bun version too old (pre-1.3.0).","error":"Cannot find module 'prisma-adapter-bun-sqlite' or its corresponding type declarations."},{"fix":"Import PrismaClient from the generated output file (e.g., './prisma/generated/client').","cause":"Importing PrismaClient from '@prisma/client' instead of generated path.","error":"TypeError: Class extends value undefined is not a constructor or null."},{"fix":"Ensure the path points to an existing file or use `:memory:` for in-memory. For file: paths, create the directory first.","cause":"The SQLite file path in `url` is incorrect or the directory does not exist.","error":"Error: The database file cannot be opened. Does it exist?"},{"fix":"Ensure `PrismaClient` is correctly instantiated with `{ adapter }` and the generated client is up-to-date (`bunx prisma generate`).","cause":"Using a raw query method with an adapter that doesn't support it (this adapter does support raw queries, but error may occur if adapter not properly configured).","error":"PrismaClientInitializationError: Invalid `prisma.user.findMany()` invocation: ... \"Raw\" is not supported"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/mmvsk/prisma-adapter-bun-sqlite#readme","github":"https://github.com/mmvsk/prisma-adapter-bun-sqlite","docs":null,"changelog":null,"pypi":null,"npm":"prisma-adapter-bun-sqlite","openapi_spec":null,"status_page":null,"smithery":null,"categories":["database"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-07","next_check":"2026-09-05","install_tag":null}}