Registry / database / sqlite-95

sqlite-95

JSON →
library8.4.0jsnpmunverified

sqlite-95 is a tiny, typed SQLite ORM built exclusively for Bun (≥ 1.0, no Node.js support). It provides a fluent, immutable query builder with TypeScript types inferred from schema definitions, includes a built-in web admin UI for browsing and editing tables, and has no runtime dependencies aside from Bun. Version 8.4.0 adds a built-in HTTP controller layer. It requires TypeScript as a peer dependency. Differenti ators: designed specifically for Bun with zero Node.js compatibility, ships with a web admin interface, and focuses on minimalism.

npm install sqlite-95
INSTALL
IMPORT
SIG · SQLITE-95
S
sqlite-95
databasejavascriptv8.4.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Table
import { Table } from 'sqlite-95'
const Table = require('sqlite-95');
ESM only; CommonJS require will fail because package is type: module and uses top-level await.
initDatabase
import { initDatabase } from 'sqlite-95'
import { initDatabase } from 'sqlite-95'; // wrong if using default import
Named export; must be imported by name.
InferFromFields
import type { InferFromFields } from 'sqlite-95'
import { InferFromFields } from 'sqlite-95'
This is a type-only export; should be imported with 'import type' to avoid runtime errors.

Shows how to initialize the database, define a table schema with fields, insert a row, and query with chained conditions.

import { Table, initDatabase } from 'sqlite-95'; import type { InferFromFields } from 'sqlite-95'; initDatabase({ file: 'app.db' }); const fields = { id: Table.number({ primaryKey: true, autoIncrement: true }), name: Table.string({ maxLength: 30 }), gold: Table.number({ canBeNull: true }), isCool: Table.boolean({ default: true }), }; type Player = InferFromFields<typeof fields>; const Players = Table.make<Player>({ name: 'players', fields }); Players.insert({ name: 'Coco', gold: 50, isCool: true }); const cool = Players.where('isCool', '=', true) .where('gold', '>=', 10) .orderBy('gold', 'DESC') .findAll(); console.log(cool); // Output: [{ id: 1, name: 'Coco', gold: 50, isCool: true }]
Debug
Known issues
breakingBun-only: sqlite-95 uses Bun APIs and will not run on Node.js. Use in Bun context only.
fix
Ensure you are using Bun runtime. See https://bun.sh for installation.
affects: >=1.0.0
gotchaESM-only: The package uses ES modules. CommonJS require will fail.
fix
Use import syntax or set "type": "module" in your package.json.
affects: >=8.0.0
deprecatedThe 'InferFromFields' type is currently documented but may be renamed in future versions.
fix
Watch release notes for changes. Use the current import path as shown.
affects: >=8.0.0
gotchaFields with 'autoIncrement' may only be numbers. Other types cause errors.
fix
Use Table.number({ primaryKey: true, autoIncrement: true }) for auto-increment IDs.
affects: >=1.0.0
Errors
Common errors & fixes
Error: Must use import to load ES Module: .../node_modules/sqlite-95/index.js
Using require() on an ESM-only package.
fix
Change to import statement or set "type": "module" in package.json and use .mjs extension if needed.
ReferenceError: require is not defined
Trying to use CommonJS require in an ESM context.
fix
Use import instead of require.
TypeError: Table.make is not a constructor
Using Table.make without passing a type parameter or missing the generic.
fix
Use Table.make<YourType>({ name, fields }) with a type argument.
Upgrade
Version history
8.4.0latest on npm
Audit
Dependencies
typescriptoptionalpeer dependency for type inference and TypeScript support
Agent activity
13 hits · last 30 days
node
10
Meta
1
OpenAI (training)
1
Resources
sqlite-95 — npm install sqlite-95 · libregistry