Skip to content

StateDBReactive Database for JavaScript

MongoDB-style queries, real-time watchers, schema validation — zero dependencies, ~20KB minified.

StateDB

MongoDB-Style API

Familiar query syntax with $gt, $in, $regex, $set, $inc, $push and more. If you know MongoDB, you know StateDB.

Reactive Watchers

Subscribe to insert, update, delete events per collection. Your UI re-renders automatically when data changes.

Schema Validation

Type checking, required fields, min/max, enum, regex, defaults, and capped collections — validated on every write.

Indexes

Single and compound indexes with unique constraints. Queries use the best index automatically — up to 145x faster.

Hooks & Persistence

Pre/post middleware for insert, update, delete. Optional auto-save to localStorage or sessionStorage with debounce.

Zero Dependencies

~20KB minified. Ships as ESM, CJS, and IIFE. Works in browsers, Node.js, and any JS runtime. Full TypeScript support.

MIT Licensed