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.
- storeOptions for defining reusable store configurations
- StoreRegistry for managing store lifecycles
Extends
Section titled “Extends”CreateStoreOptions<TSchema,TContext,TSyncPayloadSchema>
Type Parameters
Section titled “Type Parameters”TSchema
Section titled “TSchema”TSchema extends LiveStoreSchema = Any
The LiveStore schema type
TContext
Section titled “TContext”TContext = { }
User-defined context attached to the store
TSyncPayloadSchema
Section titled “TSyncPayloadSchema”TSyncPayloadSchema extends Schema.Schema<any> = typeof Schema.JsonValue
Schema for the sync payload sent to the backend
Properties
Section titled “Properties”adapter
Section titled “adapter”adapter:
Adapter
Defined in: packages/@livestore/livestore/src/store/create-store.ts:120
Adapter used for data storage and synchronization.
Inherited from
Section titled “Inherited from”batchUpdates()?
Section titled “batchUpdates()?”
optionalbatchUpdates: (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.
Parameters
Section titled “Parameters”() => void
Returns
Section titled “Returns”void
Example
Section titled “Example”// With React DOMimport { unstable_batchedUpdates as batchUpdates } from 'react-dom'
// With React Nativeimport { unstable_batchedUpdates as batchUpdates } from 'react-native'Inherited from
Section titled “Inherited from”CreateStoreOptions.batchUpdates
boot()?
Section titled “boot()?”
optionalboot: (store,ctx) =>SyncOrPromiseOrEffect<void,unknown,LiveStoreContextRunning|OtelTracer>
Defined in: packages/@livestore/livestore/src/store/create-store.ts:133
Parameters
Section titled “Parameters”Store<TSchema, TContext>
migrationsReport
Section titled “migrationsReport”{ migrations: readonly object[]; }
migrationsReport.migrations
Section titled “migrationsReport.migrations”readonly object[]
parentSpan
Section titled “parentSpan”Span
Returns
Section titled “Returns”SyncOrPromiseOrEffect<void, unknown, LiveStoreContextRunning | OtelTracer>
Inherited from
Section titled “Inherited from”confirmUnsavedChanges?
Section titled “confirmUnsavedChanges?”
optionalconfirmUnsavedChanges: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.
Default
Section titled “Default”trueInherited from
Section titled “Inherited from”CreateStoreOptions.confirmUnsavedChanges
context?
Section titled “context?”
optionalcontext: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).
Inherited from
Section titled “Inherited from”debug?
Section titled “debug?”
optionaldebug:object
Defined in: packages/@livestore/livestore/src/store/create-store.ts:196
instanceId?
Section titled “instanceId?”
optionalinstanceId:string
Inherited from
Section titled “Inherited from”disableDevtools?
Section titled “disableDevtools?”
optionaldisableDevtools:boolean|"auto"
Defined in: packages/@livestore/livestore/src/store/create-store.ts:159
Whether to disable devtools.
Default
Section titled “Default”'auto'Inherited from
Section titled “Inherited from”CreateStoreOptions.disableDevtools
logger?
Section titled “logger?”
optionallogger:Layer<never,never,never>
Defined in: packages/@livestore/common/dist/logging.d.ts:11
Optional Effect logger layer to control logging output.
Inherited from
Section titled “Inherited from”logLevel?
Section titled “logLevel?”
optionallogLevel:LogLevel
Defined in: packages/@livestore/common/dist/logging.d.ts:13
Optional minimum log level for the runtime.
Inherited from
Section titled “Inherited from”onBootStatus()?
Section titled “onBootStatus()?”
optionalonBootStatus: (status) =>void
Defined in: packages/@livestore/livestore/src/store/create-store.ts:140
Parameters
Section titled “Parameters”status
Section titled “status”{ 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"; }
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”CreateStoreOptions.onBootStatus
otelOptions?
Section titled “otelOptions?”
optionalotelOptions: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.
params?
Section titled “params?”
optionalparams:object
Defined in: packages/@livestore/livestore/src/store/create-store.ts:187
Options provided to the Store constructor.
eventQueryBatchSize?
Section titled “eventQueryBatchSize?”
optionaleventQueryBatchSize:number
Chunk size used when the stream replays confirmed events.
leaderPushBatchSize?
Section titled “leaderPushBatchSize?”
optionalleaderPushBatchSize:number
Max events pushed to the leader per write batch.
simulation?
Section titled “simulation?”
optionalsimulation:object
simulation.clientSessionSyncProcessor
Section titled “simulation.clientSessionSyncProcessor”clientSessionSyncProcessor:
object
simulation.clientSessionSyncProcessor.pull
Section titled “simulation.clientSessionSyncProcessor.pull”
readonlypull:object
simulation.clientSessionSyncProcessor.pull.1_before_leader_push_fiber_interrupt
Section titled “simulation.clientSessionSyncProcessor.pull.1_before_leader_push_fiber_interrupt”
readonly1_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”
readonly2_before_leader_push_queue_clear:number
simulation.clientSessionSyncProcessor.pull.3_before_rebase_rollback
Section titled “simulation.clientSessionSyncProcessor.pull.3_before_rebase_rollback”
readonly3_before_rebase_rollback:number
simulation.clientSessionSyncProcessor.pull.4_before_leader_push_queue_offer
Section titled “simulation.clientSessionSyncProcessor.pull.4_before_leader_push_queue_offer”
readonly4_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”
readonly5_before_leader_push_fiber_run:number
Inherited from
Section titled “Inherited from”schema
Section titled “schema”schema:
TSchema
Defined in: packages/@livestore/livestore/src/store/create-store.ts:118
The LiveStore schema defining tables, events, and materializers.
Inherited from
Section titled “Inherited from”shutdownDeferred?
Section titled “shutdownDeferred?”
optionalshutdownDeferred:ShutdownDeferred
Defined in: packages/@livestore/livestore/src/store/create-store.ts:160
Inherited from
Section titled “Inherited from”CreateStoreOptions.shutdownDeferred
storeId
Section titled “storeId”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)
Inherited from
Section titled “Inherited from”syncPayload?
Section titled “syncPayload?”
optionalsyncPayload: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
syncPayloadSchemaand carried through the adapter to the backend where it can be decoded with the same schema.
Default
Section titled “Default”undefinedInherited from
Section titled “Inherited from”CreateStoreOptions.syncPayload
syncPayloadSchema?
Section titled “syncPayloadSchema?”
optionalsyncPayloadSchema: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.JsonValueis 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.
Inherited from
Section titled “Inherited from”CreateStoreOptions.syncPayloadSchema
unusedCacheTime?
Section titled “unusedCacheTime?”
optionalunusedCacheTime: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.
Remarks
Section titled “Remarks”- Limitation: Per-store values are not yet supported. Only the registry-level default
(via
StoreRegistryconstructor’sdefaultOptions.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
Default Value
Section titled “Default Value”60_000 (60 seconds) or Infinity during SSR to avoid
disposing stores before server render completes.