SQLite

The development default, in a file at .a2/dev.db.

server/orders.ts
import { createServer } from 'experimental-a2/server'
import { sqlite } from 'experimental-a2/store-sqlite'
import { orders } from '@/contracts'

export const ordersServer = createServer({
  contract: orders,
  store: sqlite({ path: '.a2/orders.db' }),
  handlers: {
    /* ... */
  },
})

In development, a server without a store uses SQLite at .a2/dev.db, so your sessions survive next dev restarts. Pass it yourself to pick another file.

It runs on node:sqlite, with no dependencies, and creates its tables when it opens the file. It's for development: a serverless filesystem doesn't last or share one file across instances, so production needs another store.

Options

Option
paththe database file. Default .a2/dev.db; :memory: works
clock, idstest seams for timestamps and generated event ids