npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

js-doc-store-rag

v1.0.0

Published

RAG engine combining js-doc-store (structured documents) and js-vector-store (semantic search with Ollama embeddings). Hybrid search + structured filtering for Retrieval-Augmented Generation.

Downloads

137

Readme

js-doc-store-rag

RAG engine combining js-doc-store (structured documents) and js-vector-store (semantic search).

Hybrid search with structured filtering + Ollama embeddings for Retrieval-Augmented Generation.

Features

  • Dual storage: Every document lives in BOTH a document database (metadata) AND a vector store (embeddings)
  • Hybrid search: Semantic similarity (cosine) + keyword (BM25) combined via RRF
  • Structured filtering: Filter by metadata fields BEFORE semantic search (category, tags, date, etc.)
  • Local embeddings: Ollama (embeddinggemma, nomic-embed-text, etc.) — no API keys
  • MCP Server: 7 tools for Codex/Claude LLM integration
  • REST API: Index and search via HTTP
  • Context formatting: Automatically formats retrieved chunks for LLM prompting

Quick Start

Prerequisites

  • Ollama running with an embedding model: ollama pull embeddinggemma

Start the API

npm install js-doc-store-rag
npx js-doc-store-rag api

Setup collection

curl -X POST http://localhost:4000/collections/kb \
  -H "Content-Type: application/json" \
  -d '{"id":"doc-1","content":"La IA revoluciona la medicina...","metadata":{"title":"IA en Salud","category":"salud"}}'

Search with RAG

# Hybrid search with structured filter
curl "http://localhost:4000/collections/kb?q=diagnostico%20medico%20IA&mode=hybrid&limit=5"

MCP Tools

| Tool | Purpose | |------|---------| | rag_collection_setup | Create dual doc-store + vector-store collection | | rag_index_document | Index document (auto-embeds via Ollama) | | rag_search | Search with optional structured filtering | | rag_context_for_prompt | Format results as LLM-ready context | | rag_pipeline | All-in-one: search + format context | | rag_collection_info | Collection stats | | rag_usage_guide | Usage guide for LLMs |

Architecture

Document Input
    |
    v
[DocStore] --------> Structured metadata (filtering, CRUD)
    |
    v
[Ollama] --embedding--> [VectorStore] --cosine sim--> Results
    |                      ^
    v                      |
[BM25Index] --keywords----> [HybridSearch] --RRF--> Final Ranking
    |
    v
Context Formatter --> LLM Prompt

REST API

| Method | Endpoint | Description | |--------|----------|-------------| | POST | /collections/:name | Index document | | GET | /collections/:name?q=... | Search (vector/bm25/hybrid) | | GET | /collections/:name/:id | Get document |

Configuration

| Env Var | Default | Description | |---------|---------|-------------| | OLLAMA_HOST | http://localhost:11434 | Ollama API URL | | OLLAMA_MODEL | embeddinggemma:latest | Embedding model | | PORT | 4000 | API server port | | DATA_DIR | ./rag-data | Doc-store data | | VECTOR_DIR | ./rag-vectors | Vector-store data |

Integration with Codex/Claude

codex mcp add js-doc-store-rag -- node /path/to/rag-server.js

Then the LLM can:

  • Set up knowledge bases with structured schemas
  • Index documents with automatic embedding generation
  • Search with metadata filtering + semantic similarity
  • Retrieve formatted context for informed responses

License

MIT