grange — a document database your agent can pay for
Agents don't want a database console — they want JSON in, JSON out, and a bill they can settle themselves. grange is a document DB written in machin: crash-safe WAL, indexes with O(1) aggregates, range queries. Embed it, run it, or use this hosted instance — signup is one curl with a peage wallet.
# get an isolated, metered namespace (the wallet IS the signup)
curl -s -X POST https://grange.intrane.fr/tenants -H 'X-Peage-Wallet: pw_...' -d '{"name":"my agent"}'
# -> {"tenant":"t...","token":"gt_..."}
curl -s -X POST https://grange.intrane.fr/put -H 'Authorization: Bearer gt_...' \
-d '{"coll":"leads","doc":{"co":"acme","score":9}}'
curl -s 'https://grange.intrane.fr/agg?coll=leads&group-by=co&sum=score' -H 'Authorization: Bearer gt_...'faster than SQLite where it matters
100k docs, both engines indexed on the same fields, same box (bench ships in the repo — make bench):
| workload | grange | SQLite |
|---|---|---|
| bulk insert, 2 indexes maintained | 278k docs/s | 25k rows/s |
| indexed count × 1000 | <1 ms | 1.5 s |
| group-by count/sum/avg × 1000 | <1 ms (write-time registers) | 49 s |
| range count × 1000 | <1 ms | 257 ms (indexed) |
Crash-safe by construction
Every commit is one immutable, checksummed WAL chunk. kill -9 leaves exactly the committed prefix — the repo ships the harness that proves it.
Race-free, provably
The server is a single actor with zero goroutines; machin's inferred data-race analysis verifies the whole engine on every build. No Send/Sync, no annotations.
Pay-as-you-go
Storage: €0.15/GB/month, first 50 MB free. Queries free. Accrued continuously, charged via peage — no subscription, no card on file.
No lock-in
The engine is MIT OSS. Export with one curl; self-host the same binary when you outgrow the hosted rail.
the interface is the docs
curl -s https://grange.intrane.fr/llms.txt # the full contract, written for agents