Getting Started

persistence-save

Save-game persistence for Capacitor games, on SQLite everywhere.

persistence-save stores a game's saves in SQLite on every platform Capacitor targets. On the web it runs jeep-sqlite over sql.js and IndexedDB; on iOS and Android it uses the native SQLite plugin, optionally encrypted with SQLCipher. Your game writes one code path.

It is deliberately small. It does not model your game state; you give it a serialize and deserialize pair and a table of migrations, and it handles the parts that are easy to get subtly wrong.

Why use it?

Problempersistence-save
An old save crashes the new buildChained, validated N → N+1 snapshot migrations walked to the exact target
One corrupt row breaks the whole load screenlist() isolates corrupt rows; load() throws a typed CorruptSaveError
A tampered save makes JSON.parse hangSnapshot byte caps on write and read
React StrictMode writes a save twiceSaves UPSERT by name
The web build loses the last save on reloadThe web store is flushed after every write
An autosave fires every frameA scheduler with debounce, throttle and re-entrant suppression
Settings keys collide with another app'sA namespaced Preferences key-value bridge

Start with Getting started, read the migrations guide, then use the API reference and the architecture notes.