Skip to content

RegistryStoreOptions

Defined in: packages/@livestore/livestore/src/store/StoreRegistry.ts:46

Configuration options for stores managed by a StoreRegistry.

Extends CreateStoreOptions with registry-specific settings for caching and observability. Use with storeOptions helper to get full type inference when defining reusable store configurations.

TSchema extends LiveStoreSchema = Any

The LiveStore schema type

TContext = { }

User-defined context attached to the store

TSyncPayloadSchema extends Schema.Schema<any> = typeof Schema.JsonValue

Schema for the sync payload sent to the backend

adapter: Adapter

Defined in: packages/@livestore/livestore/src/store/create-store.ts:120

Adapter used for data storage and synchronization.

CreateStoreOptions.adapter


optional batchUpdates: (run) => void

Defined in: packages/@livestore/livestore/src/store/create-store.ts:153

Needed in React so LiveStore can apply multiple events in a single render.

() => void

void

// With React DOM
import { unstable_batchedUpdates as batchUpdates } from 'react-dom'
// With React Native
import { unstable_batchedUpdates as batchUpdates } from 'react-native'

CreateStoreOptions.batchUpdates


optional boot: (store, ctx) => SyncOrPromiseOrEffect<void, unknown, LiveStoreContextRunning | OtelTracer>

Defined in: packages/@livestore/livestore/src/store/create-store.ts:133

Store<TSchema, TContext>

{ migrations: readonly object[]; }

readonly object[]

Span

SyncOrPromiseOrEffect<void, unknown, LiveStoreContextRunning | OtelTracer>

CreateStoreOptions.boot


optional confirmUnsavedChanges: boolean

Defined in: packages/@livestore/livestore/src/store/create-store.ts:167

Currently only used in the web adapter: If true, registers a beforeunload event listener to confirm unsaved changes.

true

CreateStoreOptions.confirmUnsavedChanges


optional context: TContext

Defined in: packages/@livestore/livestore/src/store/create-store.ts:132

User-defined context that will be attached to the created Store (e.g. for dependency injection).

CreateStoreOptions.context


optional debug: object

Defined in: packages/@livestore/livestore/src/store/create-store.ts:196

optional instanceId: string

CreateStoreOptions.debug


optional disableDevtools: boolean | "auto"

Defined in: packages/@livestore/livestore/src/store/create-store.ts:159

Whether to disable devtools.

'auto'

CreateStoreOptions.disableDevtools


optional logger: Layer<never, never, never>

Defined in: packages/@livestore/common/dist/logging.d.ts:11

Optional Effect logger layer to control logging output.

CreateStoreOptions.logger


optional logLevel: LogLevel

Defined in: packages/@livestore/common/dist/logging.d.ts:13

Optional minimum log level for the runtime.

CreateStoreOptions.logLevel


optional onBootStatus: (status) => void

Defined in: packages/@livestore/livestore/src/store/create-store.ts:140

{ stage: "loading"; } | { progress: { done: number; total: number; }; stage: "migrating"; } | { progress: { done: number; total: number; }; stage: "rehydrating"; } | { progress: { done: number; total: number; }; stage: "syncing"; } | { stage: "done"; } | { message: string; reason: "unknown" | "private-browsing" | "storage-unavailable"; stage: "warning"; }

void

CreateStoreOptions.onBootStatus


optional otelOptions: Partial<OtelOptions>

Defined in: packages/@livestore/livestore/src/store/StoreRegistry.ts:57

OpenTelemetry configuration for tracing store operations.

When provided, store operations (boot, queries, commits) will be traced under the given root span context using the specified tracer.


optional params: object

Defined in: packages/@livestore/livestore/src/store/create-store.ts:187

Options provided to the Store constructor.

optional eventQueryBatchSize: number

Chunk size used when the stream replays confirmed events.

optional leaderPushBatchSize: number

Max events pushed to the leader per write batch.

optional simulation: object

clientSessionSyncProcessor: object

simulation.clientSessionSyncProcessor.pull
Section titled “simulation.clientSessionSyncProcessor.pull”

readonly pull: object

simulation.clientSessionSyncProcessor.pull.1_before_leader_push_fiber_interrupt
Section titled “simulation.clientSessionSyncProcessor.pull.1_before_leader_push_fiber_interrupt”

readonly 1_before_leader_push_fiber_interrupt: number

simulation.clientSessionSyncProcessor.pull.2_before_leader_push_queue_clear
Section titled “simulation.clientSessionSyncProcessor.pull.2_before_leader_push_queue_clear”

readonly 2_before_leader_push_queue_clear: number

simulation.clientSessionSyncProcessor.pull.3_before_rebase_rollback
Section titled “simulation.clientSessionSyncProcessor.pull.3_before_rebase_rollback”

readonly 3_before_rebase_rollback: number

simulation.clientSessionSyncProcessor.pull.4_before_leader_push_queue_offer
Section titled “simulation.clientSessionSyncProcessor.pull.4_before_leader_push_queue_offer”

readonly 4_before_leader_push_queue_offer: number

simulation.clientSessionSyncProcessor.pull.5_before_leader_push_fiber_run
Section titled “simulation.clientSessionSyncProcessor.pull.5_before_leader_push_fiber_run”

readonly 5_before_leader_push_fiber_run: number

CreateStoreOptions.params


schema: TSchema

Defined in: packages/@livestore/livestore/src/store/create-store.ts:118

The LiveStore schema defining tables, events, and materializers.

CreateStoreOptions.schema


optional shutdownDeferred: ShutdownDeferred

Defined in: packages/@livestore/livestore/src/store/create-store.ts:160

CreateStoreOptions.shutdownDeferred


storeId: string

Defined in: packages/@livestore/livestore/src/store/create-store.ts:130

Unique identifier for the Store instance, stable for its lifetime.

  • Valid characters: Only alphanumeric characters, underscores (_), and hyphens (-) are allowed. Must match /^[a-zA-Z0-9_-]+$/.
  • Globally unique: Use globally unique IDs (e.g., nanoid) to prevent collisions across stores.
  • Use namespaces: Prefix to avoid collisions and for easier identification when debugging (e.g., app-root, workspace-abc123, issue-456)

CreateStoreOptions.storeId


optional syncPayload: Type<TSyncPayloadSchema>

Defined in: packages/@livestore/livestore/src/store/create-store.ts:185

Payload that is sent to the sync backend when connecting

  • Its TypeScript type is inferred from syncPayloadSchema (i.e. typeof SyncPayload.Type).
  • At runtime this value is encoded with syncPayloadSchema and carried through the adapter to the backend where it can be decoded with the same schema.
undefined

CreateStoreOptions.syncPayload


optional syncPayloadSchema: TSyncPayloadSchema

Defined in: packages/@livestore/livestore/src/store/create-store.ts:175

Schema describing the shape of the sync payload and used to encode it.

  • If omitted, Schema.JsonValue is used (no additional typing/validation).
  • Prefer exporting a schema from your app (e.g. export const SyncPayload = Schema.Struct({ authToken: Schema.String })) and pass it here to get end-to-end type safety and validation.

CreateStoreOptions.syncPayloadSchema


optional unusedCacheTime: number

Defined in: packages/@livestore/livestore/src/store/StoreRegistry.ts:78

The time in milliseconds that this store should remain in memory after becoming unused. When this store becomes unused (no active retentions), it will be disposed after this duration.

Stores transition to the unused state as soon as they have no active retentions, so when all components which use that store have unmounted.

  • Limitation: Per-store values are not yet supported. Only the registry-level default (via StoreRegistry constructor’s defaultOptions.unusedCacheTime) is used. See #917 for per-store support and #918 for dynamic “longest wins” behavior.
  • If set to Infinity, will disable automatic disposal
  • The maximum allowed time is about 24 days

60_000 (60 seconds) or Infinity during SSR to avoid disposing stores before server render completes.