Registry / database / logosdb

logosdb

JSON →
library1.0.0jsnpmunverified

Fast semantic vector database (HNSW + mmap) for Node.js. Version 1.0.0 uses zero-copy memory-mapped storage for local-only deployment, with O(log n) approximate nearest neighbor search. Ships TypeScript types and prebuilt N-API binaries via @mmomtchev/prebuild-install, falling back to node-gyp rebuild (C++17, no CMake). Provides timestamp ranges, distance metrics (IP, Cosine, L2), and full CRUD. Supports Linux, macOS, Windows (x64, arm64). Node >= 16 required.

npm install logosdb
INSTALL
IMPORT
SIG · LOGOSDB
L
logosdb
databasejavascriptv1.0.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

DB
import { DB } from 'logosdb'
const DB = require('logosdb').DB
ESM and CommonJS both supported via dual package. Named export, not default.
DIST_COSINE
import { DIST_COSINE } from 'logosdb'
const DIST_COSINE = require('logosdb/DIST_COSINE')
Exported as named constant alongside DIST_IP, DIST_L2.
SearchHit
import type { SearchHit } from 'logosdb'
TypeScript-only type export; do not use at runtime.

Creates a database with cosine distance, inserts one vector, searches for top 5 nearest neighbors, and closes.

const { DB, DIST_COSINE } = require('logosdb'); const db = new DB('/tmp/mydb', { dim: 384, distance: DIST_COSINE }); const embedding = new Array(384).fill(0.1); const id = db.put(embedding, 'Sample text', '2025-01-01T00:00:00Z'); const hits = db.search(embedding, 5); for (const hit of hits) { console.log(`${hit.score.toFixed(4)} ${hit.text}`); } db.close();
Debug
Known issues
gotchaPublishing must be done from the nodejs/ directory, not the monorepo root. The root package.json is a private workspace and will fail with EPRIVATE.
fix
cd nodejs && npm publish
affects: >=1.0.0
gotchaThe prebuild script is named 'native:prebuild', not 'prebuild'. Using 'prebuild' would trigger the npm lifecycle hook and run before every build.
fix
npm run native:prebuild
affects: >=1.0.0
gotchaNode binding does not embed text; it only stores vectors. You must generate embeddings yourself (e.g., via @xenova/transformers).
fix
Preprocess text to embeddings before calling db.put().
affects: >=1.0.0
gotchaInstallation may fail on systems without Python/C++17 toolchain if no prebuilt binary is available.
fix
Install Python 3.x and a C++17 compiler (gcc, clang, MSVC).
affects: >=1.0.0
Errors
Common errors & fixes
EPRIVATE: Cannot publish package over private package
Running npm publish from monorepo root where package.json is private
fix
cd nodejs && npm publish
Error: Cannot find module 'logosdb'
Missing or failed prebuild install; no fallback compilation
fix
Ensure Python and C++17 toolchain are installed, or download prebuilt tarball from releases.
TypeError: db.put is not a function
Using default import instead of named import { DB }
fix
Use const { DB } = require('logosdb') or import { DB } from 'logosdb'
Upgrade
Version history
1.0.0latest on npm
Audit
Dependencies
@mmomtchev/prebuild-installrequiredDownloads prebuilt N-API binaries at install time
node-gypoptionalFalls back to compiling native addon if prebuilt binary unavailable; requires Python and C++17 toolchain
Agent activity
2 hits · last 30 days
node
2
Resources
logosdb — npm install logosdb · libregistry