Skip to content

RegistryStoreOptions

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

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.Codec<Schema.Json, Schema.Json> = typeof Schema.Json

Schema for the sync payload sent to the backend

adapter: Adapter

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

Adapter used for data storage and synchronization.

CreateStoreOptions.adapter


optional batchUpdates: (run) => void

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

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, OtelTracer | LiveStoreContextRunning>

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

Store<TSchema, TContext>

MigrationsReport

Span

SyncOrPromiseOrEffect<void, unknown, OtelTracer | LiveStoreContextRunning>

CreateStoreOptions.boot


optional confirmUnsavedChanges: boolean

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

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:163

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:224

optional instanceId: string

CreateStoreOptions.debug


optional disableDevtools: boolean | "auto"

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

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:171

ReadonlySide<{ stage: Literal<"loading">; }, "Type"> | ReadonlySide<{ progress: Struct<{ done: Finite; total: Finite; }>; stage: Literal<"migrating">; }, "Type"> | ReadonlySide<{ progress: Struct<{ done: Finite; total: Finite; }>; stage: Literal<"rehydrating">; }, "Type"> | ReadonlySide<{ progress: Struct<{ done: Finite; total: Finite; }>; stage: Literal<"syncing">; }, "Type"> | ReadonlySide<{ stage: Literal<"done">; }, "Type"> | ReadonlySide<{ message: String; reason: Literals<readonly ["private-browsing", "storage-unavailable", "unknown"]>; stage: Literal<"warning">; }, "Type">

void

CreateStoreOptions.onBootStatus


optional otelOptions: Partial<OtelOptions>

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

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:218

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.

CreateStoreOptions.params


schema: TSchema

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

The LiveStore schema defining tables, events, and materializers.

CreateStoreOptions.schema


optional shutdownDeferred: ShutdownDeferred

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

CreateStoreOptions.shutdownDeferred


storeId: string

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

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: TSyncPayloadSchema["Type"]

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

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:206

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

  • If omitted, Schema.Json 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:81

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.

  • Per-store values override the registry-level default (set via StoreRegistry constructor’s defaultOptions.unusedCacheTime)
  • The value is fixed when the store is first loaded into the registry. If the same storeId is requested again with a different unusedCacheTime, the original value is kept.
  • 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.