Skip to main content

TypeScript / JavaScript SDK

Push JSON, query by value or meaning, traverse graphs — from Node.js or the browser.

Install

npm install @rushdb/javascript-sdk
# or: yarn add @rushdb/javascript-sdk | pnpm add @rushdb/javascript-sdk

Connect

import RushDB from '@rushdb/javascript-sdk'

const db = new RushDB('RUSHDB_API_KEY')

Get your API token from the RushDB Dashboard.

First write

// Nested objects become linked records automatically
await db.records.importJson({
label: 'MOVIE',
data: {
title: 'Inception',
rating: 8.8,
genre: 'sci-fi',
ACTOR: [
{ name: 'Leonardo DiCaprio', country: 'USA' },
{ name: 'Ken Watanabe', country: 'Japan' }
]
}
})
// Created: MOVIE → ACTOR × 2 (relationships wired automatically)

First read

const { data: movies, total } = await db.records.find({
labels: ['MOVIE'],
where: { rating: { $gte: 8 } },
orderBy: { rating: 'desc' }
})

Configuration

const db = new RushDB('RUSHDB_API_KEY', {
url: 'http://localhost:3000/api/v1', // or use host/port/protocol
timeout: 5000 // default: 30000ms
})
OptionDefaultDescription
urlFull API URL (alternative to host/port/protocol)
hostDomain or IP
port80 / 443Port number
protocolhttpshttp or https
timeout30000Request timeout in ms
httpClientCustom HTTP client — required for Edge / Cloudflare Workers
loggerCustom logging function
options.allowForceDeletefalseMust be true to delete all records without criteria (safety gate)

Namespaces

NamespaceUse
db.recordsCreate, find, update, delete records
db.relationshipsAttach and detach edges
db.txTransactions
db.labelsList labels and counts
db.propertiesInspect field names, types, value ranges
db.aiSchema export + semantic search