Looking for the chatbot template? It's now here.
GitHub

@chat-adapter/state-memory

In-memory state adapter for Chat SDK. For development and testing only — state is lost on restart.

Warning: Only use the memory adapter for local development and testing. State is lost on restart and locks don't work across multiple instances. For production, use @chat-adapter/state-redis, @chat-adapter/state-ioredis, or @chat-adapter/state-pg.

Installation

bash
pnpm add @chat-adapter/state-memory

Usage

typescript
import { Chat } from "chat";import { createMemoryState } from "@chat-adapter/state-memory";const bot = new Chat({  userName: "mybot",  adapters: { /* ... */ },  state: createMemoryState(),});

No configuration options are needed.

Features

FeatureSupported
PersistenceNo
Multi-instanceNo
SubscriptionsYes (in-memory)
LockingYes (single-process only)
Key-value cachingYes (in-memory)
Zero configurationYes

Limitations

  • Not suitable for production — state is lost on restart
  • Single process only — locks don't work across multiple instances
  • No persistence — subscriptions reset when the process restarts

When to use

  • Local development
  • Unit testing
  • Quick prototyping

License

MIT