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 config file 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 and the.py/.jsnative-language alternative. Custom tables are defined through a config file; without one, the server runs in zero-config mode. - HTTP API — the
POST /queryandGET /eventsendpoints, status codes, and event streaming.
Installation
bash
npx dirsqlbash
uvx dirsqlbash
# Installs the binary only (the `cli` feature is non-default)
cargo install dirsql --features cli
dirsqlNode version
Requires Node ≥ 20.11.
For Rust library consumers
The cli feature is opt-in. See the Rust library README for instructions on how to include.
Quick start
From any directory containing your files (no config needed):
bash
dirsql
$ Running at localhost:7117Then query it over HTTP:
bash
curl -s http://localhost:7117/query \
-H 'content-type: application/json' \
-d '{"sql":"SELECT COUNT(*) AS n FROM files"}' \
| jqSee Running the Server for flags and HTTP API for the full endpoint reference.