CLI
init, generate, validate, schema, login, and media.
The backmatter command ships with @backmatter/core. It runs on Bun.
bunx backmatter init # config, catch-all route, instrumentation, .gitignore
bunx backmatter generate # rewrite .backmatter/
bunx backmatter validate # exit 1 when frontmatter fails the model
bunx backmatter schema # write .backmatter/schemas/{type}.json
bunx backmatter login # browser approval, token in ~/.backmatter/credentials.json
bunx backmatter media upload cover.jpg --workspace <id>
bunx backmatter media list --q cover --workspace <id>
bunx backmatter media url med_018f6b3e-7c2a-7b1d-8e4f-9a0b1c2d3e4f --width 800
withBackmatter already runs generate when the Next app compiles. Run generate yourself in CI or outside Next.
validate reads models/*.ts and the folders in each model's path. A required field that is missing fails the command. Unknown frontmatter keys are kept. Use it in pre-push or CI. Publish runs the same check.
login, media upload, and media list talk to the API. media url prints a CDN URL and does not need a token. The flags, the workspace, and what each command prints are on Media.
The client is the API reference. Field kinds are Fields. The Next.js route is Next.js.