
Node.js engine
The @surrealdb/node package is a plugin for the JavaScript SDK that runs SurrealDB as an embedded database within Node.js, Bun, or Deno. It supports in-memory databases and persistent storage via RocksDB and SurrealKV.
This package works with ES modules (import), not CommonJS (require).
Installation
First, install the JavaScript SDK if you haven’t already. Then add the Node.js engine:
npm install --save @surrealdb/node
pnpm install @surrealdb/node
Quick start
import { Surreal, createRemoteEngines } from 'surrealdb';
import { createNodeEngines } from '@surrealdb/node';
const db = new Surreal({
engines: {
...createRemoteEngines(),
...createNodeEngines(),
},
});
await db.connect('mem://');
await db.close();
For a complete guide covering engine registration, supported protocols (mem://, surrealkv://), versioned storage, and Bun/Deno compatibility, see the Node.js concept page.
Learn more