Node
Minimal example
Section titled “Minimal example”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)
Option A: Quick start
Section titled “Option A: Quick start”For a quick start, we recommend using our template app following the steps below.
-
Set up project from template
Terminal window bunx tiged github:livestorejs/livestore/examples/standalone/node-todomvc-sync-cf#dev livestore-appTerminal window pnpm dlx tiged github:livestorejs/livestore/examples/standalone/node-todomvc-sync-cf#dev livestore-appTerminal window npx tiged github:livestorejs/livestore/examples/standalone/node-todomvc-sync-cf#dev livestore-appReplace
livestore-app
with your desired app name. -
Install dependencies
It’s strongly recommended to use
bun
orpnpm
for the simplest and most reliable dependency setup (see note on package management for more details).Terminal window bun installTerminal window pnpm installTerminal window npm installPro tip: You can use direnv to manage environment variables.
-
Run dev environment
Terminal window bun startTerminal window pnpm startTerminal window npm run start