Skip to content

CreateStoreOptions

Defined in: store/create-store.ts:149

TSchema extends Adapter

TContext = { }

TSyncPayloadSchema extends Schema.Codec<Schema.Json, Schema.Json> = typeof Schema.Json

adapter: Adapter

Defined in: store/create-store.ts:158

Adapter used for data storage and synchronization.


optional batchUpdates: (run) => void

Defined in: store/create-store.ts:191

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, any>

Defined in: store/create-store.ts:171

Store<TSchema, TContext>

MigrationsReport

Span

SyncOrPromiseOrEffect<void, unknown, any>


optional confirmUnsavedChanges: boolean

Defined in: store/create-store.ts:205

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

true

optional context: TContext

Defined in: store/create-store.ts:170

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


optional debug: object

Defined in: store/create-store.ts:240

optional instanceId: string


optional disableDevtools: boolean | "auto"

Defined in: store/create-store.ts:197

Whether to disable devtools.

'auto'

optional onBootStatus: (status) => void

Defined in: store/create-store.ts:178

BootStatus

void


optional params: object

Defined in: store/create-store.ts:225

Advanced runtime tuning parameters.

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 stateRebuildBatchSize: number

Number of events read and committed per batch when rebuilding SQLite state from the event log. Lower values reduce per-batch resource usage but perform more queries and savepoints. This is a per-client runtime setting and changing it does not trigger a rebuild.

100

1


schema: TSchema

Defined in: store/create-store.ts:156

The LiveStore schema defining tables, events, and materializers.


optional shutdownDeferred: any

Defined in: store/create-store.ts:198


storeId: string

Defined in: store/create-store.ts:168

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

Defined in: store/create-store.ts:223

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: store/create-store.ts:213

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.