SQLite in LiveStore
LiveStore heavily uses SQLite as its default state/read model.
Implementation notes
-
LiveStore relies on the following SQLite extensions to be available:
-DSQLITE_ENABLE_BYTECODE_VTAB -DSQLITE_ENABLE_SESSION -DSQLITE_ENABLE_PREUPDATE_HOOK
-
For web / node adapater:
-
For Expo adapter:
- LiveStore uses the official expo-sqlite library which supports LiveStore’s SQLite requirements.
-
LiveStore uses the
session
extension to enable efficient database rollback which is needed when the eventlog is rolled back as part of a rebase. An alternative implementation strategy would be to rely on snapshotting (i.e. periodically create database snapshots and roll back to the latest snapshot + applied missing mutations).