API Reference
Complete API documentation for NenDB's high-performance graph database operations. All APIs are designed for batch processing and maximum throughput.
API Categories
NenDB Core API
Essential graph database operations including nodes, edges, and batch processing
Client Libraries
Native client libraries for popular programming languages
REST API
HTTP-based API for remote access and integration
GraphQL API
Flexible GraphQL interface for complex queries
Common Operations
Batch Node Creation
Create multiple nodes in a single batch operation for maximum throughput.
// Batch create nodes
const batch = nendb.createBatch();
batch.createNode({ id: "user:1", properties: { name: "Alice", age: 30 } });
batch.createNode({ id: "user:2", properties: { name: "Bob", age: 25 } });
batch.createNode({ id: "post:1", properties: { title: "Hello World", content: "..." } });
const results = await batch.execute();
console.log(`Created ${results.length} nodes`);Graph Traversal
Efficiently traverse relationships using NenDB's optimized graph algorithms.
// Find friends of friends within 2 hops
const query = nendb.query()
.from("user:1")
.traverse("FRIENDS", { maxDepth: 2 })
.where("age", ">", 18)
.limit(10);
const results = await query.execute();
console.log(`Found ${results.length} connections`);Batch Edge Creation
Create relationships between nodes efficiently using batch operations.
// Create relationships in batch
const batch = nendb.createBatch();
batch.createEdge("user:1", "FOLLOWS", "user:2", { since: "2024-01-15" });
batch.createEdge("user:1", "LIKED", "post:1", { timestamp: Date.now() });
batch.createEdge("user:2", "AUTHORED", "post:1", {});
const results = await batch.execute();
console.log(`Created ${results.length} relationships`);Performance Features
🚀 Batch Processing
Group multiple operations to amortize network and disk I/O costs, achieving higher throughput than individual operations.
🧠Memory Efficiency
Static memory allocation eliminates garbage collection pauses and provides predictable performance characteristics.
âš¡ Cache Optimization
Data-oriented design ensures optimal CPU cache utilization for consistent low-latency operations.
🔧 Zero Dependencies
Minimal runtime dependencies reduce complexity and potential security vulnerabilities in production environments.
Getting Started
Quick Setup
Get started with NenDB in just a few lines of code:
// Initialize NenDB connection
import { NenDB } from 'nendb';
const db = new NenDB({
host: 'localhost',
port: 7687,
database: 'graph'
});
// Connect and start using the database
await db.connect();
console.log('Connected to NenDB');
// Your graph operations here...