adapters/pglite-persistence.ts
PGlite-backed implementation of GraphPersistenceAdapter.
Stores the local-first runtime's graph snapshot inside a PGlite table (_graph_snapshot by default) instead of localStorage/IndexedDB.
_graph_snapshot
localStorage
IndexedDB
Why this exists:
Contract:
get(key)
set(key, v)
updated_at
remove(key)
The function lazily ensures the storage table exists on first call. That CREATE TABLE IF NOT EXISTS is idempotent so it's safe to retry.
CREATE TABLE IF NOT EXISTS
Self-hosted Supabase only. HotSeatersMVP is the bible. This module does not import @electric-sql/pglite — consumers pass a PGlite-shaped handle.
@electric-sql/pglite
Optional
adapters/pglite-persistence.ts
PGlite-backed implementation of GraphPersistenceAdapter.
Stores the local-first runtime's graph snapshot inside a PGlite table (
_graph_snapshotby default) instead oflocalStorage/IndexedDB.Why this exists:
Contract:
get(key)-> returns the stored string or nullset(key, v)-> upserts (insert-or-replace), stampingupdated_atremove(key)-> deletes the row (no-op if absent)The function lazily ensures the storage table exists on first call. That
CREATE TABLE IF NOT EXISTSis idempotent so it's safe to retry.Self-hosted Supabase only. HotSeatersMVP is the bible. This module does not import
@electric-sql/pglite— consumers pass a PGlite-shaped handle.