Nano-RAG - Lightweight Edge RAG Framework

Build AI knowledge base apps in 5 minutes with Next.js + Cloudflare Workers

chat.tsx
const response = await fetch('/api/chat', {
  method: 'POST',
  body: JSON.stringify({
    question: userMessage,
    messages: history
  })
});

// Streaming response with
// thinking steps & sources

Core Features

Edge Deployment

Powered by Cloudflare Workers, global low latency, millisecond response

Intelligent Retrieval

LangGraph orchestrated multi-stage RAG pipeline, precise context matching

Serverless Storage

D1 database + vector search, no extra services, zero ops cost

Quality Assurance

Built-in hallucination detection, quality checks and auto-repair for reliable answers

Quick Start

terminal
# Clone the projectgit clone https://github.com/yompc/nano-rag.gitcd nano-rag
# Install dependenciesnpm install
# Configure environmentcp .dev.vars.example .dev.vars# Edit .dev.vars and add OPENAI_API_KEY
# Initialize database and startnpx wrangler d1 execute nano-rag-db --local --file=./migrations/0001_init.sqlnpm run preview

Tech Stack

Next.js
Frontend Framework
Cloudflare Workers
Edge Runtime
D1 Database
SQLite Storage
LangGraph
AI Orchestration
OpenAI
LLM & Embedding

Start Building Your AI Knowledge Base

Upload documents, ask questions, get precise answers from AI

Try Now