Analyzed 29 days ago · 2 anonymous rescans remaining · register free to re-analyze any time.
Public analysis · read only
Register free to re-analyze

usp13/BuildYourOwnRAG

1 0 0 issues
JavaScript

Project Overview

anthropic / claude-opus-4-7

BuildYourOwnRAG

A from-scratch JavaScript RAG backend with custom vector indexes (HNSW, KD-Tree, Brute Force) using local Ollama models.

AI Verdict
Clean— AI Trust Assessment

True Intent (AI Assessment)

An educational, self-contained reference implementation of a RAG pipeline and vector search algorithms in JavaScript, using local Ollama models.

README Accuracy

Accurate

Notes

Source code aligns with README: custom HNSW, KD-Tree, and BruteForce implementations exist, Ollama is used for embeddings and generation, and the pipeline matches the described five-step flow. No obfuscation, no network calls beyond localhost Ollama, no credential handling.

What Is This?

BuildYourOwnRAG is an educational backend project that implements a Retrieval-Augmented Generation pipeline in pure JavaScript, without relying on frameworks like LangChain, LlamaIndex, or hosted vector databases such as Pinecone. It exposes an Express HTTP API for inserting documents, embedding text, performing vector similarity search, and asking questions that are answered by a local LLM grounded in retrieved chunks.

The problem it addresses is the black-box nature of most RAG tutorials. Typical projects wire together managed APIs and hide the retrieval mechanics behind SDK calls. This repository re-implements the core primitives — cosine/Euclidean/Manhattan distance metrics, a KD-Tree, a brute-force linear scanner, and an HNSW graph index — so a developer can read, modify, and benchmark them side by side.

The intended audience is engineers and students studying information retrieval, vector databases, or the internals of semantic search. It is not production infrastructure: everything lives in in-memory JavaScript data structures with no persistence, no authentication, and small demo datasets (a 20-item, 16-dimensional synthetic vector set covering CS, Math, Food, and Sports).

Architecturally the code follows a clean layered pattern. Express routes delegate to controllers, which call services (ChunkService, OllamaService, RAGService) that operate on two in-memory stores: VectorDB (multi-index, for demo vectors) and DocumentDB (HNSW-backed, 768-dim, for chunked documents). The RAG flow embeds a query via Ollama's nomic-embed-text, performs a k-NN search on HNSW, assembles a strict-context prompt via PromptBuilder, and generates an answer using llama3.2:3b through the local Ollama HTTP API.

Notable observations: the code is well-organized and matches the README claims closely. test.js is entirely commented-out manual scratch tests rather than an automated test suite, and there is no persistence layer, so all indexed documents are lost on restart. This is consistent with the stated 'reference implementation' intent rather than a red flag.

Your Report, Tab by Tab
At a Glance
1Stars
0Forks
0Open Issues
July 2026Last Active
Web AppJavaScriptNot specified
Technology Stack
LanguagesJavaScript
RuntimeNode.js (ES Modules)
FrameworkExpress 5
DatabaseIn-memory only (custom VectorDB and DocumentDB)
Package Managernpm
Key Dependenciesexpress, cors, axios, dotenv, nodemon, Ollama (external local service)
Build ToolNone
Test FrameworkNone detected (test.js contains commented-out manual tests)