Skip to main content

Getting started

Install:

npm i @liorandb/driver

Connect and use a collection

import { LioranClient } from "@liorandb/driver";

const client = new LioranClient("lioran://admin:password123@localhost:4000");
await client.connect();

const db = client.db("default");
const items = db.collection<{ _id?: string; sku: string; qty: number }>("items");

await items.insertOne({ sku: "A", qty: 1 });
console.log(await items.findOne({ sku: "A" }));

Authentication options

connect() behaves differently depending on the URI:

  • lioran://username:password@host:port → logs in and stores a JWT token
  • liorandb://dbUsername:dbPassword@host[:port]/databaseName → uses the connection string mode
  • http(s)://host:port → does not auto-login (call login() or setToken() / setConnectionString())