blendx docs

The blendx guide

This guide is for people, and AI agents, who build an API with blendx. It assumes TypeScript and HTTP, and nothing about blendx.

You write two things: schema.dbml, which describes the tables, and one small blend per table you expose, which says only what differs from the defaults. blendx derives everything else from them: validation, loading, authorization, saving, replies, routes, a typed client, an OpenAPI document, and a review file that someone who does not read TypeScript can check.

Start here

  1. Getting started: set up a project, expose a table and serve it.
  2. Tutorial: an expenses API: build examples/expenses from an empty folder. People sign up for a bearer token and file expense claims, each claim is priced from its category, and approvers approve or reject them.
  3. The walkthrough: both examples in 27 narrated steps, with their real code and the replies the running apps sent. It plays in a browser; on GitHub, which shows only its source, open the file locally.

Reference

PageWhat it covers
The schemaschema.dbml, the column conventions, what each type accepts, keys and indexes, migrations
Blendsblend(), the actions and their routes, policies, hidden columns, custom actions, declared replies
Hooksthe pipeline, each stage's hook and what it receives, the cascade, transactions, where logic goes
The app and identitydefineApp, the auth function, app-wide hooks, paging, problem types
The HTTP APIwhat a client sees: routes, index queries, replies, errors, OpenAPI, the typed client
The React client@blendx/react: TanStack Query options for every action, keys and invalidation, errors and form field errors
Reviewreview/<table>.yaml, the examples, and how a reviewer asks for a change
Testingtesting an app on PGlite or PostgreSQL, the review examples, the typed client
Configuration and deploymentblendx.config.ts, database drivers, migrations in production, serving on Bun and on Node
The CLIblendx generate, blendx review and blendx migrate
Known issueswhat does not work yet, and what to do instead

Elsewhere

Working with an AI agent

blendx is designed so that an agent writes little and a person reviews behaviour instead of code. Give your app a CLAUDE.md (or AGENTS.md): examples/addition/CLAUDE.md is the template, and examples/expenses/CLAUDE.md shows one with the app's own rules added. It tells the agent which files are its to write, which are generated, and what "done" means: blendx generate --check, blendx review --check, tsc --noEmit and bun test all pass. A person then reads review/*.yaml and, to ask for a change, edits it (Review).

Status

blendx is at version 0 and not yet on npm, so the API may still change. Getting started shows the two ways to use it today, and Known issues lists what does not work yet.