Learn
TypeScript / JavaScript SDK
The official TypeScript/JavaScript SDK for RushDB. Works in Node.js and browser environments.
Installation
npm install @rushdb/javascript-sdk
Quick Start
import RushDB from '@rushdb/javascript-sdk'
const db = new RushDB('RUSHDB_API_KEY')
// Store a record
await db.records.create({
label: 'User',
data: { name: 'Alice', role: 'engineer' }
})
// Query records
const { data } = await db.records.find({
labels: ['User'],
where: { role: 'engineer' },
limit: 10
})
To connect to a self-hosted instance pass the url option:
const db = new RushDB('RUSHDB_API_KEY', {
url: 'https://your-rushdb-instance.com/api/v1'
})
API Reference
| Class | Description |
|---|---|
| RushDB | Main client — entry point for all operations |
| DBRecord | Typed record class returned from queries |
| DBRecordInstance | Active record with instance methods (attach, detach, update, delete) |
| DBRecordsArrayInstance | Collection of records with bulk-operation methods |
| Model | Schema-bound model class for label-scoped operations |
| Relationship Patterns | Review and apply AI-suggested relationships |
| Transaction | ACID transaction handle |
| SearchQuery | Query builder types and interfaces |
| DBRecordTarget | Record reference type used in relationship calls |
| RelationTarget | Relationship target reference type |