- Deno 2.x or Node.js 18+
- SurrealDB 2.0+
=== "Deno (JSR)"
Import directly — no install step required:
```typescript
import { SurQLClient } from 'jsr:@oneiriq/surql'
```
For convenience, add an import map to your `deno.json`:
```json
{
"imports": {
"surql": "jsr:@oneiriq/surql",
"surrealdb": "npm:surrealdb@^2.0.0"
}
}
```
Then import with the short alias:
```typescript
import { SurQLClient } from 'surql'
```
=== "Node.js (npm)"
```shell
npm install @oneiriq/surql
# or
yarn add @oneiriq/surql
# or
pnpm add @oneiriq/surql
```
```typescript
import { SurQLClient } from '@oneiriq/surql'
```
=== "Node.js (JSR)"
```shell
npx jsr add @oneiriq/surql
```
brew install surrealdb/tap/surrealcurl -sSf https://install.surrealdb.com | shiwr https://windows.surrealdb.com -useb | iexdocker pull surrealdb/surrealdb:latestsurreal start --user root --pass root memorydocker run --rm -p 8000:8000 \
surrealdb/surrealdb:latest \
start --user root --pass root memoryservices:
surrealdb:
image: surrealdb/surrealdb:latest
ports:
- "8000:8000"
command: start --user root --pass root memoryimport { SurQLClient } from 'jsr:@oneiriq/surql'
const client = new SurQLClient({
host: 'localhost',
port: '8000',
namespace: 'test',
database: 'test',
username: 'root',
password: 'root',
})
const db = await client.getConnection()
const result = await db.query('SELECT * FROM $session')
console.log('Connected:', result)
await client.close()- Follow the Quick Start tutorial
- Read the Schema Definition Guide
- Explore Query Builder documentation