Overview

Where A2 keeps your session histories.

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

export const ordersServer = createServer({
  contract: orders,
  store: redis({ url: process.env.REDIS_URL }),
  handlers: {
    /* ... */
  },
})
StoreUse it for
RedisProduction (recommended)
Redis over HTTPProduction, when your provider only offers a REST API
PostgresProduction
SQLiteDevelopment: the default
MemoryTests: the default when NODE_ENV=test

When you omit store, development gets SQLite, so state survives next dev restarts, and tests get memory. Production has no default, on purpose: the server throws STORE_NOT_CONFIGURED at startup rather than write events to a filesystem that evaporates.

A store holds A2's session histories. It doesn't connect A2 to your application tables; see Sessions and your database.

Servers with handlers or timers also need a scheduler.