Skip to content

Node

import { makeAdapter } from '@livestore/adapter-node'
import { createStorePromise } from '@livestore/livestore'
import { tables, schema } from './livestore/schema.js'
const adapter = makeAdapter({
storage: { type: 'fs' },
// sync: { backend: makeCfSync({ url: '...' }) },
})
const store = await createStorePromise({ adapter, schema })
const todos = store.query(tables.todos)

For a quick start, we recommend using our template app following the steps below.

  1. Set up project from template

    Terminal window
    bunx tiged --mode=git git@github.com:livestorejs/livestore/examples/standalone/node-todomvc-sync-cf livestore-app

    Replace livestore-app with your desired app name.

  2. Install dependencies

    It’s strongly recommended to use bun or pnpm for the simplest and most reliable dependency setup (see note on package management for more details).

    Terminal window
    bun install

    Pro tip: You can use direnv to manage environment variables.

  3. Run dev environment

    Terminal window
    bun start