Skip to content

IndexedDB adapter

IndexedDBAdapter stores SavedGame records in an IndexedDB object store keyed by metadata.name. The default database is hypertoken; pass { dbName } to use another database. The connection is opened lazily and reused by the adapter.

import { IndexedDBAdapter } from "./core/storage/IndexedDBAdapter.js";

engine.useStorage(new IndexedDBAdapter({ dbName: "hypertoken" }));
await engine.persist("local-game");

IndexedDB survives a page refresh and is available while the application is offline, subject to browser storage quotas and eviction policies. The adapter does not provide cross-device synchronization, encryption, or backup. Pair it with CRDT network sync and an explicit backup/export process when those are required.