Skip to content

Using dirsql from the CLI

Online: https://thekevinscott.github.io/dirsql/cli/

dirsql ships a command-line interface that starts an HTTP server exposing the same indexing, querying, and watching functionality as the SDK — no host language required. Run it in any directory to query your files over HTTP: with no config it serves a default files table, and a .dirsql.toml config defines custom tables.

Everything you need to run dirsql as a CLI lives in this section:

Installation

bash
npx dirsql
bash
uvx dirsql
bash
# Installs the binary only (the `cli` feature is non-default)
cargo install dirsql --features cli
dirsql

For Rust library consumers

The cli feature is opt-in. Adding dirsql as a library dependency (cargo add dirsql) pulls no CLI dependencies — only the core library. See the Rust library README for the library-vs-CLI feature split.

Quick start

From a directory containing your files and a .dirsql.toml:

bash
dirsql

$ Running at localhost:7117

Then query it over HTTP:

bash
curl -s http://localhost:7117/query \
  -H 'content-type: application/json' \
  -d '{"sql":"SELECT COUNT(*) AS n FROM posts"}' \
  | jq

See Running the Server for flags and HTTP API for the full endpoint reference.

Released under the MIT License.