Open source React AI chatbot

AI chat for React.
Your UI. Your rules.

Add a customizable AI chatbot to your React app with streaming responses, server-side model integration, and optional RAG. Start with the ready-made UI or generate editable chatbot components directly into your project.

npm install react-ai-chat
React 18 & 19TypeScriptNode 18+MIT
Interactive demo

Try the chatbot yourself.

The chatbot in the bottom-right corner is powered by react-ai-chat. Open it and ask a question to see the ready-made component in action.

The chatbot is live on this page
Look for the chat button in the bottom-right corner.
Chatbot
Open the chatbot to try it
Complete control

Start with the UI. Own the source.

Generate the UI into your own codebase and change the structure, styling, text, message layout, header, input, or interaction patterns.

Explore generated UI
terminal
# Generate an editable chatbot
$ npx react-ai-chat init
Creating chatbot in ./chatbot
✓ chatbot.tsx
✓ chatbot-header.tsx
✓ chatbot-messages.tsx
✓ chatbot-input.tsx
✓ chatbot.css
Your chatbot is ready to customize.
The UI belongs to your project.
Real project

See it running in a real portfolio.

I built an AI chatbot for my portfolio using react-ai-chat, RAG, and Google Gemini. Visitors can ask questions about my projects, skills, and experience.

Next.jsGoogle GeminiRAGreact-ai-chat
Architecture

Keep the pieces you care about.

React handles the experience. Your route handles the server. Your model handles generation. RAG is there when you need grounded answers.

01

Your React app

Render the chatbot or generate editable UI directly into your project.

02

Your API route

Use createChatRoute() to connect the client to an AI SDK model.

03

AI model

Choose the model and provider that fit your application.

Optional RAGDocumentsEmbeddingsRelevant contextAI response
Optional RAG

Give your chatbot something to know.

Index your own documents with the CLI, retrieve relevant chunks at request time, and pass that context to your model. The basic chatbot stays simple when you do not need RAG.

GGoogle
OOpenAI
VVoyage
CCohere
JJina
HHugging Face
Read the RAG guide
Retrieval pipeline
Content to grounded response
01
Your documents
content/
02
Embedding index
embeddings.json
03
Relevant chunks
topK: 3
04
Model context
system prompt
05
Streaming answer
AI SDK
Tested React integrations

Works with React apps using these popular frameworks.

Next.js
Vite
React Router
Quick start

From install to first message.

Install the package, create your API route, render the chatbot, and start streaming responses.

Follow the guide
app/api/chat/route.ts
import { createChatRoute } from "react-ai-chat/server";
import { google } from "@ai-sdk/google";

export const POST = createChatRoute({
  model: google("gemini-3.5-flash"),
});
Then render <Chatbot />

Build the chat experience your app actually needs.

Start with the ready-made chatbot. Move to generated UI when your product needs deeper control.

Open source under MIT
Support the project on Patreon