SkillsApr 6, 2026·2 min read

Next.js AI Chatbot — Vercel Reference App Template

Production-ready AI chatbot template by Vercel using Next.js, AI SDK, shadcn/ui, and Auth.js. Supports Claude, GPT-4, and Gemini. Streaming, tool use, file uploads, and conversation history. 8,000+ stars.

SK
Skill Factory · Community
Quick Use

Use it first, then decide how deep to go

This block should tell both the user and the agent what to copy, install, and apply first.

npx create-next-app --example https://github.com/vercel/ai-chatbot my-chatbot
cd my-chatbot
cp .env.example .env.local
# Add your ANTHROPIC_API_KEY or OPENAI_API_KEY
npm run dev

Open http://localhost:3000 — a fully functional AI chatbot is running.


Intro

Next.js AI Chatbot is Vercel's official reference application for building production AI chatbots with 8,000+ GitHub stars. Built with Next.js App Router, Vercel AI SDK, shadcn/ui, and Auth.js, it includes streaming responses, tool use, file uploads, conversation history with PostgreSQL, and multi-model support (Claude, GPT-4, Gemini). This is the exact template Vercel uses internally and recommends for production deployments. Best for developers who want a battle-tested starting point for AI chat applications. Works with: Claude, GPT-4, Gemini. Setup time: under 5 minutes.


What You Get

Full-Stack Features

  • Streaming chat with real-time token display
  • Multi-model switching (Claude, GPT-4, Gemini)
  • Conversation history saved to PostgreSQL
  • User authentication (Auth.js with GitHub/Google)
  • File upload and processing
  • Tool use (web search, code execution)
  • Mobile-responsive UI with dark mode

Tech Stack

Layer Technology
Framework Next.js 14 (App Router)
AI Vercel AI SDK
UI shadcn/ui + Tailwind CSS
Auth Auth.js (NextAuth v5)
Database PostgreSQL (Drizzle ORM)
Hosting Vercel (one-click deploy)

Vercel AI SDK Integration

import { streamText } from "ai";
import { anthropic } from "@ai-sdk/anthropic";

export async function POST(req: Request) {
  const { messages } = await req.json();

  const result = streamText({
    model: anthropic("claude-sonnet-4-20250514"),
    messages,
    tools: {
      getWeather: {
        description: "Get weather for a location",
        parameters: z.object({ city: z.string() }),
        execute: async ({ city }) => getWeather(city),
      },
    },
  });

  return result.toDataStreamResponse();
}

One-Click Deploy

Deploy with Vercel

Customization Points

app/
├── (chat)/           # Chat pages
│   ├── page.tsx      # Main chat interface
│   └── layout.tsx    # Chat layout with sidebar
├── api/chat/         # AI API routes
│   └── route.ts      # Streaming endpoint
├── components/       # UI components
│   ├── chat.tsx      # Chat container
│   ├── message.tsx   # Message bubble
│   └── toolbar.tsx   # Input toolbar
└── lib/
    ├── ai/           # Model configuration
    └── db/           # Database schema

Key Stats

  • 8,000+ GitHub stars
  • Official Vercel reference app
  • Streaming + tool use + file upload
  • Auth + conversation history
  • One-click Vercel deploy

FAQ

Q: What is Next.js AI Chatbot? A: Vercel's official production-ready template for AI chatbots, built with Next.js, AI SDK, shadcn/ui, and PostgreSQL — including streaming, auth, and conversation history.

Q: Is it free? A: Yes, open-source under MIT. Hosting on Vercel free tier works for personal use.

Q: Can I change the AI model? A: Yes, swap anthropic(...) for openai(...) or google(...) — one line change.


🙏

Source & Thanks

Created by Vercel. Licensed under MIT.

ai-chatbot — ⭐ 8,000+

Thanks to Vercel for the definitive AI chatbot starting point.

Discussion

Sign in to join the discussion.
No comments yet. Be the first to share your thoughts.