LioranDB TypeScript Series #10: Mastering the Official LioranDB CLI
LioranDB TypeScript Series: Build with a developer-first document database powered by Rust and designed for TypeScript.
Not everything needs a dashboard.
Sometimes you just want a terminal and a database that listens.
Meet the official LioranDB CLI.
Install
npm install -g @liorandb/cli@1.0.5
The executable is:
liorandb
Initialize
liorandb init
Configure a connection:
liorandb set url \
"liorandb://admin:YOUR_PASSWORD@127.0.0.1:27018/default"
Authenticate:
printf '%s' "$LIORANDB_PASSWORD" |
liorandb login admin --password-stdin
Select a database
liorandb db use default
Create a collection:
liorandb collection create products
Insert from stdin
printf '{"sku":"bk-001","title":"Blue Notebook","active":true}' |
liorandb insert-one products --stdin
Count:
liorandb count products
Then jump into the interactive shell:
liorandb shell
Profiles
The CLI supports local profiles, which makes switching environments much less painful.
Think:
local
staging
production
client-a
client-b
instead of repeatedly pasting connection information.
Output formats
Automation doesn't want pretty tables.
Humans often do.
The CLI supports output modes including:
table
json
ndjson
quiet
Global flags include:
--profile
--url
--output
--json
--quiet
--no-color
--debug
What can the CLI control?
Quite a lot.
Data
db
collection
find
find-one
insert-one
update-one
delete-many
aggregate
count
Indexes
index list
index create
index create-text
index drop
Authentication
login
logout
whoami
sessions
change-password
Administration
user
role
settings
cors
Operations
status
health
doctor
metrics
cluster
backup
Safety
Destructive commands should be difficult to trigger accidentally.
Operations such as drops, broad deletions and backup restore/delete flows use confirmation mechanisms unless explicitly overridden where supported.
That's intentional.
A CLI should help you operate the database, not speedrun deleting Tuesday.
Local state
CLI state is stored under:
.liorandb/state
You can override the location with:
LIORANDB_STATE_DIR
Passwords are not persisted as ordinary stored profile values.
CLI + Driver
The CLI and TypeScript driver aren't competing interfaces.
A common setup is:
Application code
→ @liorandb/driver
Developers / CI / Operations
→ @liorandb/cli
Use each where it fits best.
Resources
CLI Documentation:
https://docs.liorandb.com/docs/cli/overview
Documentation: https://docs.liorandb.com
Website: https://liorandb.com
Previous: Part 9 → Operations & Backups
Next: Part 11 → Docker Compose, Caddy & TLS
Top comments (0)