MCPcopy
hub / github.com/vercel/chatbot

github.com/vercel/chatbot @v3.1.0 sqlite

repository ↗ · DeepWiki ↗ · release v3.1.0 ↗
403 symbols 1,073 edges 140 files 0 documented · 0%
README

Next.js 14 and App Router-ready AI chatbot.

Chat SDK

Chat SDK is a free, open-source template built with Next.js and the AI SDK that helps you quickly build powerful chatbot applications.

Read Docs · Features · Model Providers · Deploy Your Own · Running locally

Features

  • Next.js App Router
  • Advanced routing for seamless navigation and performance
  • React Server Components (RSCs) and Server Actions for server-side rendering and increased performance
  • AI SDK
  • Unified API for generating text, structured objects, and tool calls with LLMs
  • Hooks for building dynamic chat and generative user interfaces
  • Supports xAI (default), OpenAI, Fireworks, and other model providers
  • shadcn/ui
  • Styling with Tailwind CSS
  • Component primitives from Radix UI for accessibility and flexibility
  • Data Persistence
  • Neon Serverless Postgres for saving chat history and user data
  • Vercel Blob for efficient file storage
  • Auth.js
  • Simple and secure authentication

Model Providers

This template ships with xAI grok-2-1212 as the default chat model. However, with the AI SDK, you can switch LLM providers to OpenAI, Anthropic, Cohere, and many more with just a few lines of code.

Deploy Your Own

You can deploy your own version of the Next.js AI Chatbot to Vercel with one click:

Deploy with Vercel

Running locally

You will need to use the environment variables defined in .env.example to run Next.js AI Chatbot. It's recommended you use Vercel Environment Variables for this, but a .env file is all that is necessary.

Note: You should not commit your .env file or it will expose secrets that will allow others to control access to your various AI and authentication provider accounts.

  1. Install Vercel CLI: npm i -g vercel
  2. Link local instance with Vercel and GitHub accounts (creates .vercel directory): vercel link
  3. Download your environment variables: vercel env pull
pnpm install
pnpm dev

Your app template should now be running on localhost:3000.

Extension points exported contracts — how you extend this code

ChatHistory (Interface)
(no doc)
components/sidebar-history.tsx
SuggestedActionsProps (Interface)
(no doc)
components/suggested-actions.tsx
ConsoleOutputContent (Interface)
(no doc)
components/console.tsx
VersionFooterProps (Interface)
(no doc)
components/version-footer.tsx
UIArtifact (Interface)
(no doc)
components/artifact.tsx
MessagesProps (Interface)
(no doc)
components/messages.tsx
ImageEditorProps (Interface)
(no doc)
components/image-editor.tsx
ArtifactContent (Interface)
(no doc)
components/create-artifact.tsx

Core symbols most depended-on inside this repo

cn
called by 84
lib/utils.ts
toResponse
called by 39
lib/errors.ts
generateUUID
called by 22
lib/utils.ts
isGenerationComplete
called by 22
tests/pages/chat.ts
sendUserMessage
called by 20
tests/pages/chat.ts
getRecentAssistantMessage
called by 19
tests/pages/chat.ts
compareMessages
called by 12
tests/prompts/utils.ts
handleVersionChange
called by 10
components/artifact.tsx

Shape

Function 290
Method 56
Interface 45
Class 12

Languages

TypeScript100%

Modules by API surface

components/icons.tsx59 symbols
tests/pages/chat.ts34 symbols
lib/editor/diff.js26 symbols
lib/db/queries.ts24 symbols
tests/pages/artifact.ts14 symbols
lib/utils.ts11 symbols
tests/pages/auth.ts10 symbols
lib/editor/suggestions.tsx9 symbols
components/multimodal-input.tsx8 symbols
components/toolbar.tsx7 symbols
lib/errors.ts6 symbols
components/document-preview.tsx6 symbols

Used by 1 indexed graphs manifest dependencies, hub-wide

Dependencies from manifests, versioned

@ai-sdk/provider2.0.0-beta.1 · 1×
@ai-sdk/react2.0.0-beta.6 · 1×
@ai-sdk/xai2.0.0-beta.2 · 1×
@biomejs/biome1.9.4 · 1×
@codemirror/lang-javascript6.2.2 · 1×
@codemirror/lang-python6.1.6 · 1×
@codemirror/state6.5.0 · 1×
@codemirror/theme-one-dark6.1.2 · 1×
@codemirror/view6.35.3 · 1×
@opentelemetry/api1.9.0 · 1×
@opentelemetry/api-logs0.200.0 · 1×
@playwright/test1.50.1 · 1×

For agents

$ claude mcp add chatbot \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact