shadcn ships a chatbot template — and the tool UIs are typed
The shadcn team's own reference starter for AI chat apps: streaming, tool calls, and a questionnaire the model uses to ask you questions back.

What it does
A minimal Next.js chatbot that streams responses, renders markdown through shadcn/typeset, and calls tools: a server-side GitHub repo lookup (shown as a linked stat line with stars, forks, and language) and each provider’s built-in web search. It can also stop and ask you things — the model invokes an ask_user tool that renders a questionnaire pinned to the bottom of the message scroller, and your answers land inline in the conversation. Everything runs through the Vercel AI Gateway, and on Vercel it deploys with no configuration: OIDC handles gateway auth and usage bills against your team’s gateway credits.
The interesting bit
Assistant messages are treated as lists of typed parts, each rendered by its own component that switches on part.state — input-streaming, input-available, output-available, output-error — so progress, results, and failures each get their own UI. The types come from the tool definitions themselves via InferUITools: part.input and part.output are checked at build time, so renaming a tool field is a compile error, not a silent undefined. And ask_user is a tool with no execute function, because the executor is a human with a form.
Key highlights
- One file per tool in
tools/, and the filename is the model-facing tool name; register it intools/index.ts, add a part component and acaseinchat-message.tsx, and the wiring is done - Web-search citations dedupe into a “Searched N websites” drawer once the message finishes streaming
- Per-request guardrails: body validation, a model allowlist in
lib/models.ts, output-token and step caps, and abort on client disconnect - Vercel deployments authenticate to the AI Gateway automatically via OIDC — no API keys to manage in production
Caveats
/api/chatis public and unauthenticated, and every request spends gateway credits. The README is unusually blunt about this: it names the failure mode (“denial-of-wallet”) and tells you to add rate limiting, spend caps, and auth before real traffic- Vercel-centric by design — the AI Gateway is the only documented backend, and local development needs a gateway credential
- It’s a template, which is to say well-organized glue over Next.js, the AI SDK, and shadcn components; that’s the point, but there’s nothing here beyond the three demo tools
Verdict If you’re building a chat UI on the AI SDK and shadcn stack, this is the canonical structure for typed tool rendering — steal the parts architecture and keep the security checklist open. If you’re off Vercel or need a hardened backend, this isn’t that.
Frequently asked
- What is shadcn-ui/chatbot-template?
- The shadcn team's own reference starter for AI chat apps: streaming, tool calls, and a questionnaire the model uses to ask you questions back.
- Is chatbot-template open source?
- Yes — shadcn-ui/chatbot-template is open source, released under the MIT license.
- What language is chatbot-template written in?
- shadcn-ui/chatbot-template is primarily written in TypeScript.
- How popular is chatbot-template?
- shadcn-ui/chatbot-template has 1.2k stars on GitHub.
- Where can I find chatbot-template?
- shadcn-ui/chatbot-template is on GitHub at https://github.com/shadcn-ui/chatbot-template.