lmdb-js
Node.js bindings for LMDB (Lightning Memory-Mapped Database) — an extremely fast embedded key-value store using memory-mapped files. Provides ordered key access, ACID transactions, multi-reader/single-writer concurrency, and optionally msgpack or CBOR value encoding. Orders of magnitude faster than SQLite for pure key-value operations.
Score Breakdown
⚙ Agent Friendliness
🔒 Security
Local embedded database. No network exposure. Data stored in binary format (not human-readable). Native bindings add supply chain risk — verify prebuilt binary provenance.
⚡ Reliability
Best When
You need the fastest possible persistent key-value storage in Node.js with ACID transactions and memory-mapped I/O — an order of magnitude faster than SQLite for pure KV operations.
Avoid When
You need SQL queries, document search, or complex filtering — use better-sqlite3 or MongoDB for richer query capabilities.
Use Cases
- • Store and retrieve agent state, embeddings indexes, or large caches with sub-millisecond latency using memory-mapped I/O
- • Build high-throughput agent pipelines that need persistent key-value storage without a database server
- • Cache LLM API responses or pre-computed embeddings with fast ordered key iteration for range scans
- • Store agent conversation history or tool call results with ACID transaction guarantees for durability
- • Index large datasets for agent retrieval workflows where read performance is critical
Not For
- • Complex queries requiring SQL or document-style filtering — LMDB is key-value only; use SQLite or MongoDB for richer queries
- • Windows environments requiring write concurrency — LMDB has limitations on Windows with multiple write transactions
- • Applications expecting JSON/SQL query language — pure key-value API requires application-level indexing
Interface
Authentication
Local library — filesystem permissions control access. No built-in authentication.
Pricing
MIT license. Uses native bindings (node-gyp compilation required).
Agent Metadata
Known Gotchas
- ⚠ Map size must be set at open time (mapSize option) and cannot shrink — set 100x expected data size; LMDB uses virtual memory mapping which is cheap on 64-bit systems
- ⚠ Native bindings require node-gyp compilation — prebuilt binaries available for common platforms but CI/CD may need build tools installed
- ⚠ LMDB has a single-writer constraint — concurrent write transactions from multiple async operations must be serialized; lmdb-js handles this automatically with transaction queuing
- ⚠ Database files (.mdb) are platform-specific — databases cannot be copied between big-endian and little-endian architectures
- ⚠ Transactions must be explicitly committed or aborted — unclosed transactions leak memory; always use the transaction() helper for automatic lifecycle management
- ⚠ getRange() returns a lazy iterator — must consume fully or call return() to release; partial iteration without cleanup causes LMDB cursor leaks
Alternatives
Full Evaluation Report
Detailed scoring breakdown, competitive positioning, security analysis, and improvement recommendations for lmdb-js.
Scores are editorial opinions as of 2026-03-06.