11st of 12 in Chat apps

langchain-nextjs-template

Next.js routes for LangChain.js chat, agents, structured output and RAG

Stars
2.5k
License
MIT
Last commit
Oct 2026
Language
TypeScript

Overview

Five Next.js API routes that each show one LangChain.js pattern: plain chat, Zod structured output, a prebuilt LangGraph.js agent with Tavily search, and RAG as a chain and as an agent over a Supabase pgvector table. Tokens stream to the client through the AI SDK, routes run on Edge functions, and there is no auth or persistence beyond the vector table. For developers learning LangChain.js who want runnable routes to copy.

Who it is for: Developers learning LangChain.js on Next.js

Strengths

  • Each pattern is one route file you can lift into your own app
  • Hosted demo on Vercel
  • Mock-backed integration tests run without API keys or a live database
  • Supabase adapter reuses the documents table and match_documents function; no migration

Weaknesses

  • No auth and no chat history persistence
  • OpenAI only out of the box; other providers need code changes
  • Re-ingesting the same text duplicates vectors; no dedupe
  • Agent and search examples need a Tavily key

What it needs

  • TypeScript, openai, langchain, langgraph, ai-sdk
  • Needs openai-api-key, supabase, tavily-api-key
  • GitHub template
  • env example file

Also in Chat apps

See all 12
Also in Chat apps
RankProjectScore
2chatbotNext.js chat template with Auth.js, Postgres history and AI Gateway models Live demo ↗ (opens in a new tab)21k stars, Apache-2.054 out of 100
3chatNuxt UI chat template with GitHub login, SQLite history and AI Gateway Live demo ↗ (opens in a new tab)376 stars, MIT52 out of 100
#4gemini-chatbotNext.js chatbot template defaulting to Gemini with NextAuth and Postgres Live demo ↗ (opens in a new tab)1.4k stars, Apache-2.050 out of 100
#5claude-quickstartsIndependent Claude API starter projects, one folder per pattern17.9k stars, MIT48 out of 100
#6twitterbioSingle-form Next.js text generator streaming from Together AI Live demo ↗ (opens in a new tab)1.8k stars, MIT45 out of 100