Skip to content

CreateStoreOptions

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

  • WithLoggerOptions

TSchema extends LiveStoreSchema

TContext = { }

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

adapter: Adapter

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

Adapter used for data storage and synchronization.


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'

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>


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

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).


optional debug: object

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

optional instanceId: string


optional disableDevtools: boolean | "auto"

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

Whether to disable devtools.

'auto'

optional logger: Layer<never, never, never>

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

Optional Effect logger layer to control logging output.

LogConfig.WithLoggerOptions.logger


optional logLevel: LogLevel

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

Optional minimum log level for the runtime.

LogConfig.WithLoggerOptions.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


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


schema: TSchema

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

The LiveStore schema defining tables, events, and materializers.


optional shutdownDeferred: ShutdownDeferred

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


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)

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

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.