# vectra

> A lightweight, file-backed vector database for Node.js and browsers with Pinecone-compatible filtering and hybrid BM25 search.

Latest version **0.15.0** (published 2026-05-24) · MIT license · 0 weekly downloads

## Install

```sh
npm install vectra
pnpm add vectra
yarn add vectra
bun add vectra
```

Provides the command `vectra`.

## Health

**Score 65/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; high maintenance score; high quality score.

Warnings: low downloads; pre 1.0.

## Facts

| | |
|---|---|
| Version | 0.15.0 |
| Published | 2026-05-24 |
| First published | 2023-05-01 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=22.x |
| Dependencies | 13 |
| Unpacked size | 2.1 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 632 |
| Author | Steven Ickman |
| Maintainers | stevenic |
| Keywords | vector-database, embeddings, semantic-search, rag, retrieval-augmented-generation, openai, azure-openai, transformers, local-embeddings, cosine-similarity, bm25, hybrid-search, local-database, llm, ai, browser, electron |

## Links

- npm: https://www.npmjs.com/package/vectra
- Repository: https://github.com/Stevenic/vectra
- Homepage: https://github.com/Stevenic/vectra#readme
- Issues: https://github.com/Stevenic/vectra/issues
- npm.io page: https://npm.io/package/vectra

## Dependencies (13)

- [uuid](https://npm.io/package/uuid.md) ^13.0.0
- [yargs](https://npm.io/package/yargs.md) ^18.0.0
- [buffer](https://npm.io/package/buffer.md) ^6.0.3
- [dotenv](https://npm.io/package/dotenv.md) ^17.4.1
- [openai](https://npm.io/package/openai.md) ^6.33.0
- [cheerio](https://npm.io/package/cheerio.md) ^1.0.0
- [turndown](https://npm.io/package/turndown.md) ^7.2.0
- [wink-nlp](https://npm.io/package/wink-nlp.md) ^2.3.2
- [@grpc/grpc-js](https://npm.io/package/@grpc/grpc-js.md) ^1.14.3
- [gpt-tokenizer](https://npm.io/package/gpt-tokenizer.md) ^3.4.0
- [json-colorizer](https://npm.io/package/json-colorizer.md) ^3.0.1
- [@grpc/proto-loader](https://npm.io/package/@grpc/proto-loader.md) ^0.8.0
- [wink-bm25-text-search](https://npm.io/package/wink-bm25-text-search.md) ^3.1.2

## Alternatives

- [@expo/fingerprint](https://npm.io/package/@expo/fingerprint.md) — 6.2M weekly downloads
- [@azure/monitor-opentelemetry-exporter](https://npm.io/package/@azure/monitor-opentelemetry-exporter.md) — 850.0K weekly downloads
- [@azure/monitor-opentelemetry](https://npm.io/package/@azure/monitor-opentelemetry.md) — 624.0K weekly downloads
- [@posthog/ai](https://npm.io/package/@posthog/ai.md) — 423.3K weekly downloads
- [fakefilter](https://npm.io/package/fakefilter.md) — 63.9K weekly downloads

## Recent versions

- 0.15.0 (latest) — 2026-05-24
- 0.14.0 — 2026-04-03
- 0.12.3 — 2026-01-13
- 0.12.2 — 2026-01-09
- 0.12.1 — 2026-01-09
- 0.12.0 — 2026-01-09
- 0.11.1 — 2025-05-12
- 0.11.0 — 2025-05-07
- 0.10.1 — 2025-05-07
- 0.10.0 — 2025-03-28
- 0.9.0 — 2024-08-17
- 0.7.6 — 2024-04-05
- 0.7.5 — 2024-04-05
- 0.7.4 — 2024-04-05
- 0.7.3 — 2024-04-05
- … 22 more at https://npm.io/package/vectra/versions

## README

# Vectra: a local vector database

[![npm version](https://img.shields.io/npm/v/vectra.svg)](https://www.npmjs.com/package/vectra)
[![Build](https://github.com/Stevenic/vectra/actions/workflows/ci.yml/badge.svg)](https://github.com/Stevenic/vectra/actions/workflows/ci.yml)
[![Coverage Status](https://coveralls.io/repos/github/Stevenic/vectra/badge.svg?branch=main)](https://coveralls.io/github/Stevenic/vectra?branch=main)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![Agent Ready](https://img.shields.io/badge/Agent-Ready-blue.svg)](#agent-ready)

Vectra is a local, file-backed, in-memory vector database with an optional gRPC server for cross-language access. Each index is a folder on disk — queries use MongoDB-style metadata filtering and cosine similarity ranking, with sub-millisecond latency for small indexes.

## What's New in Vectra 0.14+

- **Browser & Electron support** — `vectra/browser` entry point with `IndexedDBStorage` and `TransformersEmbeddings`
- **Local embeddings** — `LocalEmbeddings` and `TransformersEmbeddings` run HuggingFace models with no API key
- **Protocol Buffers** — opt-in binary format, 40-50% smaller files
- **gRPC server** — `vectra serve` exposes 19 RPCs for cross-language access
- **FolderWatcher** — auto-sync directories into a document index
- **Language bindings** — `vectra generate` scaffolds clients for 6 languages
- **0.15: Performance improvements** — skip-if-unchanged document upserts, shallow-clone transactional snapshots, heap-based top-K query ranking, parallel metadata loads, and O(N) batch chunk deletion

See the [Changelog](https://stevenic.github.io/vectra/changelog) for breaking changes and migration details.

## Install

```sh
npm install vectra
```

## Quick Example

```ts
import { LocalDocumentIndex, OpenAIEmbeddings } from 'vectra';

const docs = new LocalDocumentIndex({
  folderPath: './my-index',
  embeddings: new OpenAIEmbeddings({
    apiKey: process.env.OPENAI_API_KEY!,
    model: 'text-embedding-3-small',
    maxTokens: 8000,
  }),
});

if (!(await docs.isIndexCreated())) {
  await docs.createIndex({ version: 1 });
}

await docs.upsertDocument('doc://readme', 'Vectra is a local vector database...', 'md');

const results = await docs.queryDocuments('What is Vectra?', { maxDocuments: 5 });
if (results.length > 0) {
  const sections = await results[0].renderSections(2000, 1, true);
  console.log(sections[0].text);
}
```

## Documentation

Full docs at **[stevenic.github.io/vectra](https://stevenic.github.io/vectra/)**:

| Guide | Description |
|-------|-------------|
| [Getting Started](https://stevenic.github.io/vectra/getting-started) | Install, requirements, quick start with both index types |
| [Core Concepts](https://stevenic.github.io/vectra/core-concepts) | Index types, metadata filtering, on-disk layout |
| [Embeddings Guide](https://stevenic.github.io/vectra/embeddings) | Choose and configure an embeddings provider |
| [Document Indexing](https://stevenic.github.io/vectra/documents) | Chunking, retrieval, hybrid search, FolderWatcher |
| [CLI Reference](https://stevenic.github.io/vectra/cli) | All CLI commands, flags, and provider config |
| [API Reference](https://stevenic.github.io/vectra/api-reference) | TypeScript API overview |
| [Best Practices](https://stevenic.github.io/vectra/best-practices) | Performance tuning, troubleshooting |
| [Storage](https://stevenic.github.io/vectra/storage) | Pluggable backends, browser/IndexedDB, serialization formats |
| [gRPC Server](https://stevenic.github.io/vectra/grpc) | Cross-language access and language bindings |
| [Changelog](https://stevenic.github.io/vectra/changelog) | Breaking changes and migration guides |
| [Tutorials](https://stevenic.github.io/vectra/tutorials/) | RAG pipeline, browser app, gRPC, custom storage, folder sync |
| [Samples](./samples/) | Runnable examples: quickstart, RAG, browser, SQLite storage, gRPC, folder watcher |

## Agent Ready

Vectra ships an [`llms.txt`](https://github.com/Stevenic/vectra/blob/main/llms.txt) file that gives coding agents everything they need to integrate Vectra into your project. Point your agent at it and let it do the work:

```
Read the llms.txt file at https://raw.githubusercontent.com/Stevenic/vectra/main/llms.txt
and then add Vectra support to this project. Use LocalDocumentIndex for document
storage and retrieval.
```

The `llms.txt` file covers all exports, index types, CLI commands, gRPC bindings, and on-disk format — enough for any coding agent to scaffold a working integration without browsing docs.

## License

MIT License. See [LICENSE](LICENSE).

## Contributing

See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines. Please review our [Code of Conduct](CODE_OF_CONDUCT.md).

---
_Source: https://npm.io/package/vectra · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
