sqlite-95
v8.4.2
Published
SQLite ORM with a web admin
Readme
sqlite-95
A tiny, typed SQLite ORM for Bun — with a built-in web admin to browse and edit your tables.
- Fluent, immutable query builder
- TypeScript types inferred from your schema
- Minimal HTTP controller layer
- Web admin out of the box
- No runtime dependencies besides Bun
Install
bun add sqlite-95Requires Bun ≥ 1.0. Not compatible with Node.
Quick start
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();Documentation
- Queries —
findAll,findOne,insert,update,remove,count,rawSql, immutability,toSQLintrospection. - Controllers — JSON / HTML / text / file responses, redirects, cookies, headers, middleware.
Reading from
node_modules? The same docs ship inside the package —cat node_modules/sqlite-95/docs/queries.md— or browse them on GitHub.
Running in production
Create a
.envfile based on the template.Start with pm2:
pm2 start src/index.tsPut Nginx in front for HTTPS.
If you can't use a config file, pass values as env vars:
PORT=3300 BASE_PATH=/sqlite-admin pm2 \
start --node-args "--es-module-specifier-resolution=node" \
server/index.js --name sqlite-adminLicense
MIT
