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:
| Export | What it is |
|---|---|
chatpack(options) | The single factory - returns { api, handler, transport, telemetry, options } |
ChatpackError | Domain 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 |
| Types | ChatpackOptions, ChatpackUser, AuthHook, PermissionHooks, StorageAdapter, Transport, ChatpackPlugin, Conversation, Participant, Message, MessageRole, TelemetryPayload, ... |
Subpath @chatpack/core/plugins:
| Export | What it is |
|---|---|
typing() | Typing indicators - POST /conversations/:id/typing → typing.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.
| Export | What it is |
|---|---|
createChatClient(options?) | One per-application client instance |
conversations / messages | Typed REST namespaces with { data, error } results |
realtime | One lazy EventSource with durable deduplication |
@chatpack/client/plugins | Typing, presence, and receipts client adapters |
@chatpack/adapter-memory
In-memory storage - zero-setup demos and fast, deterministic tests. The
reference StorageAdapter implementation.
| Export | What it is |
|---|---|
memoryAdapter() | Create an in-memory storage adapter |
@chatpack/adapter-drizzle
Drizzle ORM (Postgres) storage - real persistence for production. Peer
dependency on drizzle-orm.
| Export | What it is |
|---|---|
drizzleAdapter(db) | Create the adapter from any Drizzle Postgres instance |
chatpackSchema | Drizzle table objects (for your drizzle-kit flow) |
conversations, conversationParticipants, messages | The individual tables |
migrationSql | Idempotent DDL as one string (no Drizzle needed to run it) |
migrationStatements | The same DDL split for one-statement-per-call drivers |
@chatpack/next
Next.js App Router integration - sugar for mounting the handler.
| Export | What it is |
|---|---|
toNextRouteHandlers(chat, options?) | Returns { GET, POST, PATCH, DELETE } for a catch-all route file |
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.