← Back to Portfolio
GitHub Project · github.com/arunkumar-dot/rag-document-assistant

Lumen — Full-Stack Document Q&A Assistant

Local-first RAG platform with Next.js 14 App Router, Hono API proxy, pgvector HNSW retrieval, and buffered Ollama token streaming

Next.js 14TypeScriptReact 18Tailwind CSSHonoNode.jsSupabase (pgvector)Ollama (llama3.1)unpdf
Context

Engineered Lumen, a production-grade full-stack document Q&A assistant and retrieval-augmented generation (RAG) platform. Features a responsive Next.js 14 App Router frontend paired with a modular Hono/Node.js backend, Supabase pgvector HNSW embeddings, and local Ollama inference (llama3.1:8b, nomic-embed-text).

Problem

Cloud LLM APIs introduce recurring token expenses, latency overhead, and critical data privacy risks for proprietary PDFs. Concurrently, naive RAG architectures suffer from exposed API credentials in browser bundles, slow full-table vector scans under growing corpora, and UI crashes caused by fragmented streaming TCP chunk boundaries.

Solution

Architected a secure server-side API proxy layer in Next.js route handlers that isolates backend Bearer tokens from the browser. Built a high-throughput Hono API with PDF ingestion (unpdf), automatic duplicate document purge/cascade logic, and hybrid retrieval (70% HNSW ANN vector cosine distance + 30% tsvector full-text search). Implemented a custom line-buffered streaming parser that reassembles split NDJSON tokens, accompanied by interactive source citation cards, document lifecycle management, and automated post-upload document summarization.

Outcome

Delivered a zero-cloud-cost, 100% private RAG assistant providing sub-second token streaming, hardened against network chunk fragmentation and credential leakage. Provides complete document library management (upload, chunk tracking, cascade delete) with grounded prompt constraints eliminating hallucination.