langchain-ai/langchain-nextjs-template

LangChain + Next.js starter template

What it solves

This project provides a ready-to-use starter template for developers who want to build AI-powered applications using LangChain.js and Next.js. It removes the boilerplate of setting up a full-stack AI app, demonstrating how to implement common LLM patterns like streaming chat, structured data extraction, and retrieval-augmented generation (RAG).

How it works

The template uses Next.js for the frontend and serverless Edge functions for the backend. It integrates the Vercel AI SDK to stream tokens to the client in real-time. For the AI logic, it leverages LangChain.js and LangGraph.js to orchestrate LLM calls, manage stateful agentic workflows, and connect to vector stores (using Supabase by default) for document retrieval.

Who it’s for

Full-stack developers and AI engineers who want to quickly prototype or launch a Next.js application that incorporates advanced LLM capabilities without starting from scratch.

Highlights

  • Multiple AI Patterns: Includes pre-built examples for simple chat, structured output using Zod, and complex multi-step agents.
  • RAG Implementation: Demonstrates both chain-based and agent-based retrieval augmented generation with vector store integration.
  • Edge-Ready: Optimized for serverless Edge functions with a focus on small bundle sizes to fit within free-tier limits.
  • Agentic Workflows: Uses LangGraph.js to implement flexible, customizable AI agents.

Related

  • Project
  • Project
  • Project
  • Project
  • Project