Using dirsql from the 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 — get the
dirsqlbinary. - Running the Server — subcommands and flags.
- Generating a Config (
init) — scaffold a.dirsql.toml. - Configuration File — the
.dirsql.tomlformat. Custom tables are defined exclusively through this file; without it, the server runs in zero-config mode. - HTTP API — the
POST /queryandGET /eventsendpoints, status codes, and event streaming.
Installation
npx dirsqluvx dirsql# Installs the binary only (the `cli` feature is non-default)
cargo install dirsql --features cli
dirsqlFor 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:
dirsql
$ Running at localhost:7117Then query it over HTTP:
curl -s http://localhost:7117/query \
-H 'content-type: application/json' \
-d '{"sql":"SELECT COUNT(*) AS n FROM posts"}' \
| jqSee Running the Server for flags and HTTP API for the full endpoint reference.