What problem does it solve?
Developers building AI chat interfaces need a reliable way to stream user prompts and model responses with durability, replayability, and real‑time synchronization across multiple clients and server‑side rendering contexts.
Core Features & Use Cases
- durableStreamConnection: client‑side adapter that ties TanStack AI's useChat to a Durable Stream for bi‑directional messaging.
- toDurableChatSessionResponse: server‑side helper that writes model output to the stream while optionally creating the stream on‑demand.
- SSR hydration: materializeSnapshotFromDurableStream materializes the current conversation snapshot for server‑rendered pages.
- Multi‑client live sync: enable live:true in useChat to keep all participants up‑to‑date.
- Secure read‑proxy: server endpoint forwards Durable Stream reads without exposing the secret.
Use cases include building collaborative chat assistants, AI‑driven support bots, and real‑time multi‑user storytelling apps.
Quick Start
Create a chat session by importing durableStreamConnection, configuring the send and read URLs, and passing the connection to useChat with live synchronization enabled.