Cookbook
Reusable patterns to copy into any project
The Cookbook contains self-contained, portable patterns you can copy into any AI chat application. Unlike the main docs which focus on ChatJS installation and configuration, these recipes work independently of ChatJS.
Recipes by Category
Streaming
Patterns for handling real-time AI response streams.
Resumable Streams
Continue AI responses after connection interruptions using Redis pub/sub
Tool Part
Connect backend tools to frontend UI components with loading states
Models
Patterns for the model system.
Data
Database patterns and state management.
Next.js Chat Transition
Preserve first-message chat state while navigating through the App Router
Credit Tracking
Track and limit AI usage with credit budgets
Neon Branching
Isolated database environments for schema development
Auth
Authentication patterns for AI applications.
AI UX
User experience patterns for chat interfaces.
Follow-up Questions
Generate contextual follow-up suggestions after AI responses
Chat Layout
Resizable split-panel layout with collapsible secondary panel
Development
Workflow patterns for local development.