100% openCypher TCK Compliant

Graph Database.
Zero Complexity.

A lightweight graph database with full Cypher support, powered by SQLite. Neo4j 3.5 feature parity. No JVM, no complex setup. Just npm install and go.

$ npm install leangraph

Built for Developers

Everything you need to add graph capabilities to your application, without the operational overhead.

Instant Setup

No database server required. Local SQLite storage in development, HTTP client for production. Same code, both environments.

Cypher Queries

Use the expressive Cypher query language. MATCH, CREATE, MERGE, DELETE, WITH, UNION and more. Familiar if you know Neo4j.

TypeScript Native

First-class TypeScript support with full type definitions. Generic query methods for type-safe results.

SQLite Powered

Battle-tested SQLite under the hood. Copy your database file to back up. No complex replication or sharding.

Low Footprint

~50MB RAM vs 1GB+ for Neo4j. Perfect for edge deployments, containers, and resource-constrained environments.

Self-Hostable

Run the server anywhere. Single binary, no dependencies. Full CLI for project management, backups, and queries.

Simple, Powerful API

Get started in minutes with an intuitive API that feels natural.

app.ts
import { LeanGraph } from 'leangraph';

// Initialize - works in dev & production
const db = await LeanGraph({
  project: 'social-network',
});

// Create a social graph
await db.execute(`
  CREATE (alice:User {name: 'Alice'})
    -[:FOLLOWS]->
  (bob:User {name: 'Bob'})
    -[:FOLLOWS]->
  (charlie:User {name: 'Charlie'})
`);

// Query with Cypher
const users = await db.query(`
  MATCH (u:User)-[:FOLLOWS*1..2]->(f:User)
  WHERE u.name = 'Alice'
  RETURN DISTINCT f.name AS friend
`);

console.log(users);
// [{ friend: 'Bob' }, { friend: 'Charlie' }]
cypher queries
-- Create nodes and relationships
CREATE (n:Person {name: 'Alice'})

-- Pattern matching
MATCH (a:Person)-[:KNOWS]->(b:Person)
WHERE a.age > 21
RETURN b.name

-- Variable-length paths
MATCH (a)-[:FOLLOWS*1..3]->(b)
RETURN DISTINCT b

-- Aggregation
MATCH (u:User)-[:POSTED]->(p:Post)
RETURN u.name, count(p) AS posts
ORDER BY posts DESC

-- Merge (upsert)
MERGE (u:User {email: $email})
ON CREATE SET u.created = timestamp()
ON MATCH SET u.lastSeen = timestamp()

-- Database introspection
CALL db.labels() YIELD label
RETURN label

Why LeanGraph?

Graph capabilities without the operational complexity.

Feature LeanGraph Neo4j
Setup npm install JVM + Server config
Development mode Local SQLite, zero config Server required
Memory usage ~50MB 1GB+ minimum
Backup Copy SQLite file Enterprise license
Cypher support Full (Neo4j 3.5 parity) Full
License MIT (fully open) GPLv3 / Commercial
Best for Apps, prototypes, edge Enterprise, analytics

Ready to try it?

Add graph database capabilities to your project in under 5 minutes.