Getting Started
The RAG Starter Kit is a production-ready boilerplate for building AI-powered document chatbots. It uses Retrieval-Augmented Generation (RAG) to give your LLM access to your own documents, so it can answer questions grounded in your data rather than hallucinating.
What is RAG?
Retrieval-Augmented Generation is a technique that enhances LLM responses by first retrieving relevant documents from a knowledge base, then feeding those documents as context to the model. This means the chatbot can cite sources, stay up to date with your latest documents, and avoid making things up.
How it works in this project:- You upload documents (PDF, DOCX, TXT, HTML, and more).
- Documents are split into chunks and embedded into vector representations.
- Chunks are stored in PostgreSQL with the pgvector extension.
- When a user sends a message, the system retrieves the most relevant chunks.
- Those chunks are injected into the LLM prompt as context.
- The LLM generates a grounded answer with citations.
Tech Stack
Next.js 15
App Router, Server Components, Streaming
TypeScript
Full type safety across the stack
PostgreSQL + pgvector
Vector storage and similarity search
Prisma
Type-safe database client and migrations
NextAuth.js v5
Authentication with OAuth, credentials, and SAML SSO
Vercel AI SDK
Streaming chat responses and tool calls
LangChain
Document parsing, chunking, and retrieval
Tailwind CSS
Utility-first styling with dark mode
Upstash Redis
Serverless rate limiting and caching
Inngest
Reliable background job processing
Cloudinary
File storage with image optimization
Prisma Postgres
Managed PostgreSQL with Accelerate
Prerequisites
- 1.Bun — runtime and package manager.
- 2.A PostgreSQL database with the pgvector extension enabled. The easiest option is a free Prisma Postgres database at console.prisma.io.
- 3.An LLM API key. The default provider is OpenRouter which offers free models. Get a key at openrouter.ai/keys.
- 4.A Google Gemini API key for embeddings (free tier: 1,500 requests/day). Get one at aistudio.google.com.