@chatpack/adapter-memory
v0.8.1
Published
In-memory storage adapter for Chatpack - zero-setup demos and fast, deterministic tests
Readme
@chatpack/adapter-memory
In-memory storage adapter for Chatpack. Zero setup, backed by JavaScript Maps - perfect for demos, examples, and fast deterministic tests.
Data is lost when the process exits. Use a database adapter in production -
@chatpack/adapter-drizzle(Postgres) is published and ready. On serverless/edge platforms each isolate has its own memory, so this adapter effectively stores nothing there.
This package is also the reference implementation of the StorageAdapter
contract - all twenty-one required methods, including the five that groups added
(createGroupConversation, addParticipants, removeParticipant,
setParticipantRole, updateConversation) and the two that mentions added
(setMessageMentions, listMentionsByMessageIds) - plus all four optional
capabilities: search, the nine-method invites namespace behind invite links and
join requests, the one-method channels namespace behind the public channel
directory, and the moderation namespace behind blocks, mutes, reports and
bans. Writing your
own adapter? Start by reading src/index.ts, then follow
Part 2 of llms.txt for the invariants it demonstrates.
Install
# pick your package manager
npm install @chatpack/core @chatpack/adapter-memory
pnpm add @chatpack/core @chatpack/adapter-memory
bun add @chatpack/core @chatpack/adapter-memoryUse
import { chatpack } from "@chatpack/core";
import { memoryAdapter } from "@chatpack/adapter-memory";
const chat = chatpack({ storage: memoryAdapter() });Community
- Discord — chat with the team and other developers
- X — releases and updates
- Docs — the full documentation site
- GitHub Discussions — questions, show-and-tell, and feedback
