Skip to content

Commands

jamster edited this page Nov 21, 2026 · 1 revision

Server Commands

Quorum server includes a built-in operator CLI. While the server is running, the terminal will show a > that commands can be typed into to view stats, manage the database, change settings, authenticate and shut down the server. The server itself keeps running while commands execute - the CLI runs on its own thread and only interacts with the server through an explicit command.

What commands are

  • namespaced - Most commands use a namespace:action format, for example server:shutdown or db:table. A few operate at "top level" and have no namespace (notably help).
  • Table-driven - Every command is defined exactly once as a row in a static table. That one row provides the help text, the auth requirements, and the handler - so help output, auth gating and dispatch all come from the same source of truth.
  • split across three tables - commands are split between three tables depending on the binary:
Table File Applied to
CORE_COMMANDS server/quorum-core/src/cli/registry.rs Both quorum-public and quorum-private
PUBLIC_COMMANDS server/quorum-public/src/cli/mod.rs quorum-public only
PRIVATE_COMMANDS server/quorum-private/src/cli/mod.rs quorum-private only

When a server starts, its table is built by chaining core commands onto that binary's extras. The important rule of thumb If a command is needed by both servers -> put it in quorum-core. If needed by only public or private -> only that binary needs the command.

Core server commands

Command Description Usage Auth Admin
help Lists all available commands, or details for one help [command] no no
server:status Shows uptime and basic server info server:status no no
server:logout Ends the current operator session server:logout yes no
server:shutdown Gracefully shuts the server down server:shutdown yes yes
server:logs Displays recent server logs server:logs [days] no no
server:audit Displays recent audit logs server:audit [days] no no
db:stats Displays database statistics db:stats no no
db:table Displays records from a table db:table , no no

Public only server commands

Command Description Usage Auth Admin
config Views or updates the server configuration config [show | ] no yes
server:login Authenticates an operator session server:login no no
server:update-database Re-initializes the database schema server:update-database no no
db:delete Deletes ALL database data after confirmation db:delete yes yes
user:delete Deletes a user account user:delete yes yes
test:run Runs functional tests on the server test:run no no

Private only server commands

Command Description Usage Auth Admin
config Views or updates the server configuration config [show | ] no yes
server:login Authenticates an operator session server:login no no
db:delete Deletes ALL database data after confirmation db:delete yes yes

Auth Key means help marks the command with a * to indicate it related to the logged-in session. "Admin" means the command is enforced and the registry will refuse to run it until someone has run server:login with the correct server passphrase within the last 20 minutes.

How to add a command

This will walk through how to add an example command.

Step 1 - write a handler for the command to call

Handlers live in the binary that they're for. Shared handlers go in quorum-core/src/cli. Either in an excluding file there or a new file. For example a command that's called with server:X will go in /src/cli/server.rs where as an entirely new command might want a new .rs file in /src/cli.

Handler format

The handler function is just a function like any other, just with a few minor important things to note.

The function signature must be exactly pub async fn ... (ctx: CmdCtx)

Part 2 - register a command

What command you write depends entirely on which binary needs the command.

Command needed by Register the row in
Both servers CORE_COMMANDS, in server/quorum-core/src/cli/mod.rs
Public server only PUBLIC_COMMANDS, in server/quorum-public/src/cli/mod.rs
Private server only PRIVATE_COMMANDS, in server/quorum-private/src/cli/mod.rs

To add a row to the static table of commands, use the cmd! macro, for example:

crate::cmd!(
    "db:count",
    "Counts the rows in a table.",
    "Prints the number of rows in the specified table.",
    "db:count <table>",
    false,
    false,
    &[("table", "The name of the table to count")],
    crate::cli::db::count
),

The order of where this is put in the table doesn't affect the usage of the command, but for readability, keep commands grouped and in logical order.

Run down of the fields in cmd!

| Field | Meaning

-- | -- | -- 1 | name | Full command name, lowercase, namespace:action. Must be unique. 2 | summary | One-liner shown by help. 3 | description | Full explanation shown by help . 4 | usage | The usage string, e.g. db:count

. Use [x] for optional, for required. 5 | requires_auth | Marks the command with * in the help listing. Display only. 6 | requires_admin | Enforced: treated like db:delete — refused unless an operator logged in with the server passphrase within the last 20 minutes. 7 | params | Parameter metadata for help — (name, meaning) tuples. Display only. 8 | handler | Path to your async function, e.g. crate::cli::db::count.

Clone this wiki locally