Skip to content
// EFFECT DAYS 2026

BrowserPersistence unstable

IndexedDB-backed persistence layers for browser Effect programs.

This module provides a low-level BackingPersistence layer and a higher-level Persistence layer that store object values in IndexedDB. Values are stored by persistence store id and key, and reads check TTL expiration before returning stored data. The database name can be customized and defaults to "effect_persistence".

2 exports Since v4.0.0 Source

Layers

Since v4.0.0

Creates a BackingPersistence layer backed by IndexedDB, optionally using the provided database name.

Details

The database name defaults to "effect_persistence". Entries are stored by persistence store id and key in a shared object store, and TTL expiration is checked when values are read.

Gotchas

Building the layer can fail with PersistenceError if IndexedDB cannot be opened. Acquisition can be interrupted while waiting for an open request. Connections close on versionchange so other tabs can upgrade or delete the database. Store operations report PersistenceError for IndexedDB request, transaction, quota, and structured-clone failures.

See

Signature

declare function layerBackingIndexedDb(options?: {
readonly database?: string;
}): Layer<BackingPersistence, PersistenceError>
Since v4.0.0

Creates a Persistence layer backed by IndexedDB, optionally using the provided database name.

Details

Building the layer can fail with PersistenceError if IndexedDB cannot be opened. The database name defaults to "effect_persistence".

See

Signature

declare function layerIndexedDb(options?: {
readonly database?: string;
}): Layer<Persistence, PersistenceError>