Recipes
Overview

Recipes

Practical patterns for common use cases.

Stream Claude in Next.js

The complete pattern for Anthropic Claude in a Next.js App Router project, from install to streaming response.

FastAPI backend

Use react-ai-stream with a Python FastAPI server — stream from any LLM through StreamingResponse.

Custom markdown rendering

Replace MarkdownRenderer with your own — custom syntax highlighting theme, LaTeX support, custom link handling.

Persist chat state

Save and restore conversation history using localStorage or a database, with onComplete and clearMessages.