cd46edcb67
CI / test (push) Has been cancelled
CI / verify (push) Has been cancelled
Clients CI / build-server (push) Has been cancelled
Clients CI / test-python (push) Has been cancelled
Clients CI / test-javascript (push) Has been cancelled
Clients CI / test-nim (push) Has been cancelled
Clients CI / test-rust (push) Has been cancelled
Storage fixes: - Fix bloom filter hash2 OverflowDefect (uint64 instead of int Hash) - Fix MemTable.put size calculation on overwrite (was leaking size) - Fix fuzz_test duplicate-key issues in LSM delete and SSTable tests Test fixes: - Fix stress_test.nim: replace deprecated threadpool with std/threads - Fix fuzz_test.nim: add missing imports (tables, algorithm, sets) - Fix fuzz_test.nim: var sst for close() compatibility - Remove unused imports from test_all.nim and bench_all.nim Docker / CI fixes: - Fix Dockerfile.source: invalid nimlang/nim:2.2.10-alpine tag → 2.2.10 + ubuntu:24.04 runtime - Fix Dockerfile.source healthcheck (--spider → -qO- for 200 OK) - Fix Dockerfile run comment ports (9470/9471 → 9912/9913) - Fix scripts/docker-run.sh healthcheck port (9470 → 9912) - Add ARG BUILD_DATE/VCS_REF to Dockerfile for docker-build.sh - Update all version strings 1.1.4 → 1.1.6 across nimble/docker/source/docs
BaraDB JavaScript / Node.js Client
Official JavaScript client for BaraDB — a multimodal database engine written in Nim.
Features
- Binary wire protocol — fast TCP communication
- Promise-based API — modern async/await
- Query builder — fluent SQL construction
- Parameterized queries — safe from SQL injection
- Vector & JSON support — first-class multimodal types
- TypeScript definitions — included out of the box
Installation
npm install baradb
Or from source:
git clone https://codeberg.org/baraba/baradb
cd clients/javascript
npm link
Quick Start
const { Client } = require('baradb');
async function main() {
const client = new Client('localhost', 9472);
await client.connect();
const result = await client.query("SELECT name, age FROM users WHERE age > 18");
for (const row of result) {
console.log(row.name, row.age);
}
await client.close();
}
main().catch(console.error);
Parameterized Queries
const { Client, WireValue } = require('baradb');
async function main() {
const client = new Client('localhost', 9472);
await client.connect();
const result = await client.queryParams(
'SELECT * FROM users WHERE age > $1 AND country = $2',
[WireValue.int64(18), WireValue.string('BG')]
);
for (const row of result) {
console.log(row);
}
await client.close();
}
Query Builder
const { Client, QueryBuilder } = require('baradb');
async function main() {
const client = new Client('localhost', 9472);
await client.connect();
const result = await new QueryBuilder(client)
.select('name', 'email')
.from('users')
.where('active = true')
.orderBy('name')
.limit(10)
.exec();
for (const row of result) {
console.log(row);
}
await client.close();
}
Vector Search
const { Client, WireValue } = require('baradb');
async function main() {
const client = new Client('localhost', 9472);
await client.connect();
const result = await client.queryParams(
'SELECT id, name FROM products ORDER BY embedding <-> $1 LIMIT 5',
[WireValue.vector([0.1, 0.2, 0.3])]
);
await client.close();
}
Running Tests
Unit tests (no server):
npm run test:unit
Integration tests (requires server on localhost:9472):
# Start server
docker run -d -p 9472:9472 baradb:latest
# Run integration tests
npm run test:integration
# Run all tests
npm test
API Reference
new Client(host, port, options)
| Option | Default | Description |
|---|---|---|
host |
localhost |
Server hostname |
port |
9472 |
TCP wire protocol port |
database |
default |
Default database |
username |
admin |
Username |
password |
"" |
Password |
timeout |
30000 |
Socket timeout in ms |
Methods
connect()— open TCP connectionclose()— close connectionquery(sql)— execute SELECT-like queryqueryParams(sql, params)— parameterized queryexecute(sql)— execute DDL/DML, returns affected rowsauth(token)— JWT authenticationping()— health check
License
Apache-2.0