Skip to content

makeAdapter

makeAdapter(__namedParameters): Adapter

Defined in: adapter.ts:128

Creates a single-threaded LiveStore adapter for Node.js applications.

This adapter runs the leader thread (persistence and sync) in the same thread as your application. Suitable for CLI tools, scripts, and applications where simplicity is preferred over maximum performance.

For production servers or performance-critical applications, consider makeWorkerAdapter which runs persistence/sync in a separate worker thread.

NodeAdapterOptions & object

Adapter

import { makeAdapter } from '@livestore/adapter-node'
import { makeWsSync } from '@livestore/sync-cf/client'
const adapter = makeAdapter({
storage: { type: 'fs', baseDirectory: './data' },
sync: {
backend: makeWsSync({ url: 'wss://api.example.com/sync' }),
},
})
// With DevTools support
const adapter = makeAdapter({
storage: { type: 'fs', baseDirectory: './data' },
devtools: {
schemaPath: new URL('./schema.ts', import.meta.url),
port: 4242,
},
})

https://livestore.dev/docs/reference/adapters/node for setup guide