TinyBase logoTinyBase

persisters

The persisters module of the TinyBase project provides a simple framework for saving and loading Store and MergeableStore data, to and from different destinations, or underlying storage types.

Many entry points are provided (in separately installed modules), each of which returns different types of Persister that can load and save a Store. Between them, these allow you to store your TinyBase data locally, remotely, to SQLite databases, and across synchronization boundaries with CRDT frameworks.

PersisterStorageStoreMergeableStore
SessionPersisterBrowser session storageYesYes
LocalPersisterBrowser local storageYesYes
FilePersisterLocal file (where possible)YesYes
IndexedDbPersisterBrowser IndexedDBYesNo
RemotePersisterRemote serverYesNo
Sqlite3PersisterSQLite in Node, via sqlite3YesYes*
SqliteWasmPersisterSQLite in a browser, via sqlite-wasmYesYes*
ExpoSqlitePersisterSQLite in React Native, via expo-sqliteYesYes*
CrSqliteWasmPersisterSQLite CRDTs, via cr-sqlite-wasmYesNo
ElectricSqlPersisterElectric SQL, via electric-sqlYesNo
LibSqlPersisterLibSQL for Turso, via libsql-clientYesNo
PowerSyncPersisterPowerSync, via powersync-sdkYesNo
YjsPersisterYjs CRDTs, via yjsYesNo
AutomergePersisterAutomerge CRDTs, via automerge-repoYesNo
PartyKitPersisterPartyKit, via the persister-partykit-server moduleYesNo

(*) Note that SQLite-based Persisters can currently only persist MergeableStore data when using the JSON-based DpcJson mode, and not in a tabular fashion.

Since persistence requirements can be different for every app, the createCustomPersister function in this module can also be used to easily create a fully customized way to save and load Store data.

See also

Since

v1.0.0

Interfaces

There is one interface, Persister, within the persisters module.

Enumerations

There is one enumeration, Persists, within the persisters module.

Functions

There is one function, createCustomPersister, within the persisters module.

Type Aliases

These are the type aliases within the persisters module.