CreateStoreOptions
Defined in: packages/@livestore/livestore/src/store/create-store.ts:142
Extends
Section titled “Extends”LoggerOptions
Extended by
Section titled “Extended by”Type Parameters
Section titled “Type Parameters”TSchema
Section titled “TSchema”TSchema extends LiveStoreSchema
TContext
Section titled “TContext”TContext = { }
TSyncPayloadSchema
Section titled “TSyncPayloadSchema”TSyncPayloadSchema extends Schema.Codec<Schema.Json, Schema.Json> = typeof Schema.Json
Properties
Section titled “Properties”adapter
Section titled “adapter”adapter:
Adapter
Defined in: packages/@livestore/livestore/src/store/create-store.ts:151
Adapter used for data storage and synchronization.
batchUpdates()?
Section titled “batchUpdates()?”
optionalbatchUpdates: (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.
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'boot()?
Section titled “boot()?”
optionalboot: (store,ctx) =>SyncOrPromiseOrEffect<void,unknown,OtelTracer|LiveStoreContextRunning>
Defined in: packages/@livestore/livestore/src/store/create-store.ts:164
Parameters
Section titled “Parameters”Store<TSchema, TContext>
migrationsReport
Section titled “migrationsReport”MigrationsReport
parentSpan
Section titled “parentSpan”Span
Returns
Section titled “Returns”SyncOrPromiseOrEffect<void, unknown, OtelTracer | LiveStoreContextRunning>
confirmUnsavedChanges?
Section titled “confirmUnsavedChanges?”
optionalconfirmUnsavedChanges: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.
Default
Section titled “Default”truecontext?
Section titled “context?”
optionalcontext: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).
debug?
Section titled “debug?”
optionaldebug:object
Defined in: packages/@livestore/livestore/src/store/create-store.ts:224
instanceId?
Section titled “instanceId?”
optionalinstanceId:string
disableDevtools?
Section titled “disableDevtools?”
optionaldisableDevtools:boolean|"auto"
Defined in: packages/@livestore/livestore/src/store/create-store.ts:190
Whether to disable devtools.
Default
Section titled “Default”'auto'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”LogConfig.LoggerOptions.logger
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”LogConfig.LoggerOptions.logLevel
onBootStatus()?
Section titled “onBootStatus()?”
optionalonBootStatus: (status) =>void
Defined in: packages/@livestore/livestore/src/store/create-store.ts:171
Parameters
Section titled “Parameters”status
Section titled “status”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">
Returns
Section titled “Returns”void
params?
Section titled “params?”
optionalparams:object
Defined in: packages/@livestore/livestore/src/store/create-store.ts:218
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.
schema
Section titled “schema”schema:
TSchema
Defined in: packages/@livestore/livestore/src/store/create-store.ts:149
The LiveStore schema defining tables, events, and materializers.
shutdownDeferred?
Section titled “shutdownDeferred?”
optionalshutdownDeferred:ShutdownDeferred
Defined in: packages/@livestore/livestore/src/store/create-store.ts:191
storeId
Section titled “storeId”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)
syncPayload?
Section titled “syncPayload?”
optionalsyncPayload: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
syncPayloadSchemaand carried through the adapter to the backend where it can be decoded with the same schema.
Default
Section titled “Default”undefinedsyncPayloadSchema?
Section titled “syncPayloadSchema?”
optionalsyncPayloadSchema: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.Jsonis 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.