LeanGraph is a lightweight, embeddable graph database with full Cypher query support, powered by SQLite. Current stable version is 1.2.2, released under the MIT license with regular updates. It passes 100% of the openCypher TCK (2,684 scenarios, Neo4j 3.5 baseline), providing Cypher feature parity with Neo4j 3.5. Key differentiators include instant startup, ~50MB memory footprint, no Docker or JVM requirement, offline operation, and simple backup via file copy. Ideal for production graph workloads without infrastructure complexity, offering local, remote, and test modes. TypeScript types are shipped with the package.
npm install leangraphNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates creating a local LeanGraph database, inserting nodes and a relationship, querying with Cypher, and closing the connection.
Use const db = await LeanGraph(options);
Install better-sqlite3 as a dependency (npm install better-sqlite3).
Set LEANGRAPH_API_KEY=lg_xxx in your environment.
Ensure ./data directory exists, or set dataPath option.
Use import type { LeanGraphOptions } from 'leangraph' for type-only imports.npm install better-sqlite3
const db = await LeanGraph({ project: 'myapp' }); // no 'new' keywordmkdir -p ./data or set dataPath option to an existing directory.
Set LEANGRAPH_API_KEY=lg_xxx environment variable.