Skip to main content

Connection strings

LioranDB uses two different “URI” formats in the ecosystem:

Admin/login URI (lioran://)

This is a legacy-style URI used for logging into the server with a username/password:

lioran://<username>:<password>@<host>:<port>

Used by:

  • ldb-cli
  • @liorandb/driver (new LioranClient(...))

Example (driver)

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

const client = new LioranClient("lioran://admin:admin@localhost:4000");
await client.connect(); // logs in and stores a JWT token

Database connection string (liorandb://)

This is a database-scoped credential format:

liorandb://<dbUsername>:<dbPassword>@<host>[:<port>]/<databaseName>

Used by:

  • @liorandb/driver (connect() auto-detects and uses it)

Example (driver)

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

const client = new LioranClient("liorandb://db_user:db_pass@localhost:4000/app");
await client.connect(); // uses x-liorandb-connection-string under the hood

const items = client.db("app").collection("items");
console.log(await items.count());