@drasi/lib

Embed the Drasi continuous-query engine in your Node.js application

Embed Drasi in your Node.js app

@drasi/lib runs Drasi's continuous-query engine in-process in Node.js — no servers, no brokers, no Kubernetes. Define sources and reactions in plain JavaScript, or load native Drasi plugins at runtime.

How @drasi/lib Works

Install the package, create Sources, Continuous Queries, and Reactions in code, and handle changes as they happen. Everything runs in-process — a native (napi-rs) addon hosts the embeddable Drasi engine inside Node, with prebuilt binaries for Windows, Linux (x64/arm64), and Apple-silicon macOS.

Install
npm install @drasi/lib
Write Code
Create Sources, Queries, and Reactions
React to Change
Handle result diffs in your app

Push graph changes from your own application code into a JavaScript source, run a continuous query in Cypher or GQL, and receive the added, updated, and removed rows in a JavaScript reaction — all without leaving your Node.js process. When you need to connect to real systems, load Drasi’s native source, reaction, and bootstrap plugins at runtime, or pull them straight from the ghcr.io/drasi-project OCI registry.

When to Use @drasi/lib

@drasi/lib is ideal when you are building a Node.js application or service and need efficient, precise change detection without deploying separate infrastructure:

  • Event-driven services — react to data changes without polling; get before/after states for every change.
  • Real-time dashboards — stream live query results into a UI over your own channel (WebSocket, SSE, IPC).
  • In-app reactive logic — replace complex event wiring with declarative continuous queries over your application state.
  • Desktop apps — embed the engine directly in Electron’s main process (the addon is N-API v9, ABI-stable).
  • Custom data pipelines — add reactive queries to ETL processes or stream processors.

Documentation

Everything you need to build with @drasi/lib, from a first continuous query to the full API surface.