Skip to content

Repository files navigation

poche

Agent-first headless CMS — one machin binary, grange underneath, no UI.
Constraints · RBAC · REST · atomic mutations · paging · realtime /watch · files.
Built for agents ([cli-specs](https://cli-specs.intrane.fr/)).

# `poche telemetry` shows exactly what poche reports about itself; disable with
# POCHE_TELEMETRY=0 or DO_NOT_TRACK=1. It never sends your content, schemas,
# collection names or tokens — only version, os/arch, verb and exit class.

# Linux x86_64, statically linked — no runtime dependencies, no glibc floor:
curl -fsSL https://github.com/javimosch/poche/releases/latest/download/poche-linux-amd64 -o poche
chmod +x poche
# ...or build it yourself:
./build.sh                         # needs machin
export POCHE_DB=./poche.data
./poche init                       # → admin_token
./poche schema define articles title:string views:int published:bool
./poche data create articles title=Hi views=1 published=true
./poche role add editor
./poche grant editor articles read,create,update
./poche user add bob editor        # → bearer token
./poche schema expose articles read,create,update
./poche serve 7700
curl -H "Authorization: Bearer $TOK" http://127.0.0.1:7700/api/articles
curl -H "Authorization: Bearer $TOK" 'http://127.0.0.1:7700/watch?coll=articles&since=0&timeout=25'

Why poche

Pillar Meaning
CMS, not SQL schemas + documents + grants — PocketBase-shaped, headless
Agent-native JSON stdout, typed stderr errors, exit 80–119, guide / help-json / feedback / update
grange storage crash-safe document DB; faster than SQLite on indexed workloads (bench 100k)
ordered listing ?sort=<field>&order=desc uses grange's range index when the field has one (schema index <coll> <field> --range): 5-6 ms vs 1190-1354 ms for the scan+sort fallback, measured over HTTP on 4000 documents
keyset paging ?after=<cursor> continues an ordered page using the next cursor in the response. Costs the same on page 500 as page 1, and cannot show a row twice or skip one when rows change elsewhere — unlike ?offset=, which is still there for arbitrary jumps
Realtime long-poll /watch over grange's change ring
No UI CLI + HTTP only; docs site for humans

Bench (100k docs)

POCHE_DB=/tmp/poche-bench ./poche bench --n 100000

Typical on a laptop: ~180k docs/s bulk insert with 2 indexes; indexed find/count in <1 ms.

Real machin backends

examples/ contains three compiled dogfood applications:

  • twitter-social-media — profiles, posts, follows, likes, timeline;
  • amazon-marketplace — catalog and stock-safe orders using CAS;
  • car-renting — interval availability, reservations and paged fleet queries.

Run all three end-to-end:

./examples/test.sh

Building them found and fixed 19 concrete poche gaps: machine bootstrap, required and unique fields, server timestamps, bounds, references, atomic increment/CAS, pagination totals, bounded sorting, SDK escaping, count/range APIs, file cleanup/RBAC, CORS and correct create semantics.

Schema modifiers

title:string!required
slug:string!unique
created_at:int!now
price_cents:int!min=0!max=1000000
seller_id:string!ref=sellers

Agent contract

  • stdout = {"ok":true,"version":"0.2.1","data":…}
  • stderr = {"ok":false,"error":{code,type,message,…}}
  • exit: 0 · 80–89 input · 90–99 resource · 100–109 integration · 110–119 internal
  • poche guide · poche help-json · poche feedback "…" · poche update

Stack

poche (CMS) → grange (engine) → machin

See VISION.md · ROADMAP.md · docs

License

MIT

About

Agent-first headless CMS over grange — one machin binary, no UI

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages