Skip to content

Repository files navigation

RAGDock

A local-first RAG document chatbot. Upload PDFs or add a website URL, index them into a vector database, and ask questions grounded in that content — with citations. Built with Next.js, TypeScript, LangChain.js, Pinecone, Groq, and Ollama.

See tasks/prd-rag-document-chatbot.md for the full product spec and tasks/tasks-rag-document-chatbot.md for the implementation task list.

Local Services

This app depends on two local services in addition to npm run dev:

1. Ollama (local embeddings + local chat)

Install Ollama, then pull the models referenced in .env.local:

# install: https://ollama.com/download
ollama pull nomic-embed-text   # embedding model (must match OLLAMA_EMBEDDING_MODEL)
ollama pull llama3.2:3b        # chat model (must match OLLAMA_CHAT_MODEL). llama3.2:1b also
                                # runs but is too small to reliably follow the grounding prompt.
ollama serve                   # usually already running as a background service

Confirm it's reachable:

curl http://localhost:11434/api/tags

2. Pinecone Local (vector database, via Docker)

docker compose up -d

This runs the Pinecone Local emulator on http://localhost:5080 (see docker-compose.yml). It does not require a real Pinecone account or API key, and data does not persist across restarts — that's expected for local dev.

Environment Variables

Copy .env.local.example to .env.local and fill in GROQ_API_KEY if you plan to use Groq. Everything else has a working local default. See src/lib/config/env.ts for validation.

cp .env.local.example .env.local

Getting Started

With Ollama and Pinecone Local running:

npm install
npm run dev

Open http://localhost:3000.

Project Structure

src/
├── app/            # Next.js App Router pages + API route handlers
├── components/     # React components (layout, sources, chat, developer)
├── hooks/          # Client-side state hooks
├── lib/
│   ├── ai/         # Chat + embedding model provider factories
│   ├── config/     # Env loading, centralized RAG constants
│   ├── db/         # SQLite schema + queries (app metadata)
│   ├── rag/        # Loaders, splitter, vector store, ingest, retrieve, answer
│   ├── storage/    # Local file storage for uploaded PDFs
│   └── validation/ # Zod schemas for API requests
└── types/          # Shared TypeScript types
data/
├── ragdock.sqlite  # App metadata (git-ignored)
└── uploads/        # Uploaded PDF files (git-ignored)

About

Local-first RAG document chatbot — upload PDFs or index a webpage, ask questions, and get grounded answers with page/URL citations.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages