Skip to main content
Build web apps, agents, and AI applications with the Memvid Node.js SDK. Native bindings deliver blazing-fast performance with a TypeScript-first API.

Installation

Requirements: Node.js 18+, macOS/Linux/Windows. Native bindings included - no extra dependencies needed.

create() will OVERWRITE existing files without warning!Always check if the file exists before choosing — see example below.

Quick Start


API Reference


Core Functions

File Operations

Framework Adapters

Choose an adapter for your framework:

Auto-Embedding

The SDK automatically enables vector embeddings when OPENAI_API_KEY is set in your environment:
How it works:
  • If OPENAI_API_KEY is set and enableEmbedding is not specified, embeddings are auto-enabled
  • Uses OpenAI’s text-embedding-3-small model (1536 dimensions)
  • If no API key is present and no model specified, falls back to local bge-small (384 dimensions)
Set OPENAI_API_KEY once in your environment and the SDK handles the rest. No need to pass enableEmbedding: true or specify models.

Data Ingestion

put() - Add Single Document

putMany() - Batch Ingestion

putFile() - Document Parsing

Ingest documents directly from files. Supports PDF, DOCX, XLSX, PPTX, and more. The SDK automatically extracts text content and creates searchable frames.

putFiles() - Batch Document Ingestion

Ingest multiple documents at once:
Supported Formats:
  • PDF - Text extraction with page-aware chunking
  • DOCX - Microsoft Word documents
  • XLSX - Excel spreadsheets (all sheets, formulas evaluated)
  • PPTX - PowerPoint presentations (slide text and notes)
No extra dependencies required - document parsing is built into the native bindings.
For XLSX files with formulas, the SDK extracts the calculated values, not the formula text. This ensures searchable, meaningful content.

Search & Retrieval

Query Syntax: Multi-word queries use OR logic by default for better recall. Use AND for intersection: "machine AND learning". Use quotes for exact phrases: '"machine learning"'.

Permission-Aware Retrieval (ACL)

See Permission-Aware Retrieval (ACL) for the full model. At a high level:
  • Write per-frame ACL metadata during ingestion (metadata.acl_*)
  • Pass aclContext + aclEnforcementMode: 'enforce' to find() / ask()

ask() - LLM Q&A

Grounding & Hallucination Detection

The ask() response includes a grounding object that measures how well the answer is supported by context:
Grounding Fields: Follow-up Fields:

correct() - Ground Truth Corrections

Store authoritative corrections that take priority in future retrievals:
Use correct() to fix hallucinations or add verified facts. Corrections receive boosted retrieval scores and are labeled [Correction] in results.

Memory Cards (Entity Extraction)

Automatic Enrichment

Manual Memory Cards

Export Facts


Table Extraction


Time-Travel & Sessions

Timeline Queries

Session Recording


Encryption & Security


Tickets & Capacity


Cloud Project & Memory Management

Programmatically create projects and memories on the Memvid dashboard, then bind local .mv2 files to them.

Configure SDK

Create and List Projects

Project Response Fields:

Create and List Memories

Bind Local File to Cloud Memory

Complete Example


Embedding Providers

External Providers

Local Embeddings (No API Required)


Error Handling


Asset Extraction


Environment Variables


Deploying to Vercel

The Memvid Node.js SDK uses native bindings (N-API) for optimal performance. When deploying to Vercel’s serverless environment, you need to configure Next.js to bundle the native binary correctly.

next.config.ts Configuration

Add outputFileTracingIncludes to ensure the native .node files are bundled with your serverless functions:

Explicit Platform Package (Optional)

For more reliable deployments, explicitly add the Linux platform package to your dependencies:
Vercel’s serverless runtime uses Amazon Linux 2 (x64). The SDK automatically selects the correct platform binary, but explicit inclusion ensures bundling works correctly.

Serverless /tmp Storage

Vercel’s serverless functions have ephemeral /tmp storage that doesn’t persist between invocations. For production apps:
  1. Use cloud storage (S3, R2, etc.) to persist .mv2 files
  2. Download on-demand when the function cold starts
  3. Pass files as buffers between API routes instead of file paths

Troubleshooting


TypeScript Types


Next Steps

Quickstart

Build your first AI memory in 5 minutes

Embedding Providers

Compare local and external embedding options

Framework Integrations

LangChain, LlamaIndex, Vercel AI, and more

Memory Cards

O(1) entity lookups and fact extraction