Chatpack
Reference

Packages

Every @chatpack/* package, what it exports, and when you need it.

All packages are MIT-licensed and published to npm. Everything is 0.x until the public API stabilizes - expect minor breaking changes before 1.0.

@chatpack/core

The engine: domain logic, permissions, HTTP handler, SSE, plugins, telemetry. The only package every integration needs.

Main exports:

ExportWhat it is
chatpack(options)The single factory - returns { api, handler, transport, telemetry, options }
ChatpackErrorDomain error with a stable code
pairKeyFor(a, b)Deterministic DM pair key (internal detail, exported for adapters/tests)
inProcessTransport()The default single-node transport
isEphemeralEvent(event)Type guard for TransportEvent
TypesChatpackOptions, ChatpackUser, AuthHook, PermissionHooks, StorageAdapter, Transport, ChatpackPlugin, Conversation, Participant, Message, MessageRole, TelemetryPayload, ...

Subpath @chatpack/core/plugins:

ExportWhat it is
typing()Typing indicators - POST /conversations/:id/typingtyping.started / typing.stopped
presence(options?)Online/offline - SSE connection is the heartbeat; offlineDelayMs default 5000
receipts()Delivered/read ticks - hooks into send + mark-read

@chatpack/client

The framework-agnostic browser client for the public REST and SSE contract. Authentication remains owned by the application.

import { createChatClient } from "@chatpack/client";
import { typingClient, presenceClient, receiptsClient } from "@chatpack/client/plugins";

export const chatClient = createChatClient({
  credentials: "include",
  plugins: [typingClient(), presenceClient(), receiptsClient()],
});

const result = await chatClient.conversations.list();

@chatpack/client/react adds useConversations, useConversation, useMessages, useRealtimeStatus, and first-party plugin hooks. It uses useSyncExternalStore and has no state-library dependency.

ExportWhat it is
createChatClient(options?)One per-application client instance
conversations / messagesTyped REST namespaces with { data, error } results
realtimeOne lazy EventSource with durable deduplication
@chatpack/client/pluginsTyping, presence, and receipts client adapters

@chatpack/adapter-memory

In-memory storage - zero-setup demos and fast, deterministic tests. The reference StorageAdapter implementation.

ExportWhat it is
memoryAdapter()Create an in-memory storage adapter

Memory adapter

@chatpack/adapter-drizzle

Drizzle ORM (Postgres) storage - real persistence for production. Peer dependency on drizzle-orm.

ExportWhat it is
drizzleAdapter(db)Create the adapter from any Drizzle Postgres instance
chatpackSchemaDrizzle table objects (for your drizzle-kit flow)
conversations, conversationParticipants, messagesThe individual tables
migrationSqlIdempotent DDL as one string (no Drizzle needed to run it)
migrationStatementsThe same DDL split for one-statement-per-call drivers

Drizzle / Postgres

@chatpack/next

Next.js App Router integration - sugar for mounting the handler.

ExportWhat it is
toNextRouteHandlers(chat, options?)Returns { GET, POST, PATCH, DELETE } for a catch-all route file

Next.js guide

llms.txt in every tarball

Every published package ships the repo's llms.txt - the single-fetch integration guide for AI builders and coding agents - at its root: node_modules/@chatpack/core/llms.txt.

Versioning

Releases are managed with Changesets; every package keeps a CHANGELOG.md. Follow releases on GitHub or via npm view @chatpack/core dist-tags.

On this page