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

Memory

In-memory state adapter for local development and testing.

An in-memory state adapter for development and testing. Zero configuration required.

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 Redis or ioredis.

Installation

Terminal
pnpm add @chat-adapter/state-memory

Usage

lib/bot.ts
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

  • Thread subscriptions (in-memory)
  • Locking (single-process only)
  • Zero configuration

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

On this page

GitHubEdit this page on GitHub