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| Rank | Project | Score |
|---|---|---|
| 2 | chatbotNext.js chat template with Auth.js, Postgres history and AI Gateway models | 54 out of 100 |
| 3 | chatNuxt UI chat template with GitHub login, SQLite history and AI Gateway | 52 out of 100 |
| #4 | gemini-chatbotNext.js chatbot template defaulting to Gemini with NextAuth and Postgres | 50 out of 100 |
| #5 | claude-quickstartsIndependent Claude API starter projects, one folder per pattern | 48 out of 100 |
| #6 | twitterbioSingle-form Next.js text generator streaming from Together AI | 45 out of 100 |