Skip to content
On this page

stratadb

StrataDB - A type-safe document database built on SQLite

Remarks

StrataDB provides a MongoDB-like API with full TypeScript type safety, backed by SQLite for reliability and performance. It uses JSONB storage with generated columns for indexed fields.

Example

typescript
import { Strata, createSchema, type Document } from 'stratadb';

type User = Document<{
  name: string;
  email: string;
  age: number;
}>;

const userSchema = createSchema<User>()
  .field('name', { type: 'TEXT', indexed: true })
  .field('email', { type: 'TEXT', indexed: true, unique: true })
  .field('age', { type: 'INTEGER', indexed: true })
  .build();

const db = new Strata({ database: 'app.db' });
const users = db.collection('users', userSchema);

await users.insertOne({ name: 'Alice', email: 'alice@example.com', age: 30 });
const adults = await users.find({ age: { $gte: 18 } });

Classes

Type Aliases

Functions

Released under the MIT License.