💠
TinyBase logo

TinyBase

state

A tiny, dependency-free, reactive data store and synchronization engine for JavaScript applications. It provides granular subscriptions so UIs only re-render when relevant data changes, keeping apps fast and predictable.Data can be modeled as simple key-value pairs or as tabular structures with rows and cells. Built-in capabilities include schemas with defaults and type inference, indexes for fast lookups, metrics for aggregations, relationships between tables, an undo/redo checkpoint system, and a SQL-adjacent query engine (TinyQL) for selecting, joining, filtering, and grouping—reactively.Designed for local-first and offline-first workflows, it offers native CRDT support via MergeableStore to synchronize and deterministically merge data across clients and servers. Persistence is available to browser storage and IndexedDB, as well as databases like SQLite and PostgreSQL, plus integrations with Yjs and Automerge.Optional React bindings include hooks and lightweight UI components for building fully reactive interfaces, along with an in-app Inspector to view and edit store data live during development. Despite its breadth, the core remains small (around 5.3kB–11.7kB gzipped), fully documented, and rigorously tested.

Features

  • Reactive in-memory data store
  • Key-value and tabular data models
  • Granular listeners and subscriptions
  • TinyQL query engine (select/join/filter/group)
  • Indexes for fast lookups
  • Metrics and aggregations
  • Table relationships
  • Schemas with defaults and type inference
  • Checkpoints with undo/redo
  • Native CRDT MergeableStore
  • Synchronization over WebSockets, BroadcastChannel, and custom transports
  • Persistence to browser storage and IndexedDB
  • Database persistence for SQLite and PostgreSQL (and variants like Bun/Expo SQLite)
  • Integrations with Yjs, Automerge, CR-SQLite, PGlite, ElectricSQL, Turso, PartyKit, Cloudflare Durable Objects
  • Optional React hooks and prebuilt components (ui-react, ui-react-dom)
  • In-app data Inspector devtool
  • Local-first and offline-friendly design
  • Tiny bundle size with zero dependencies
  • 100% test coverage and extensive docs

Stats

GitHub Stars4.7K

NPM Downloads22.1K/week

Details

Latest Version6.5.2

Created at12/31/2021

Updated at8/16/2025

LicenseMIT License

Related Items

Get a monthly E-Mail with the newest developments in UI!