Entities
How a recipe declares its tables — name, row count, fields, and the table-level constructs that shape whole rows.
Last updated 2026-09-13 · Generated from recipe-rules.ts + recipe-vocab.json · Markdown
An entity is one table. It has a name, a row count, a list of fields, and optionally a construct that shapes whole rows at once: a constraint across columns, a flow through statuses, a tree, or a graph. The engine builds parents before children, so a table that others point at is always generated first.
Table-level keys
- rows — How many rows this table gets.
- constraints (e.g. dispatched_on >= ordered_on) — A rule across columns that every row must satisfy. One per line. Dates compare as dates. Rows that fail are re-rolled, and the receipt says how often.
- flow — A status that is the end of a real journey, with dates in order. Names the status column, the legal moves between states, and which date column marks each one.
- tree — A hierarchy built level by level — loops impossible.
- graph — Parts connected through an edge table, quantities multiplied.
Every key an entity accepts
- constraints, fields, flow, graph, name, no_overlap, rows, tree
A two-table recipe
{
"project": "orders",
"seed": 42,
"output": {
"format": "csv"
},
"entities": [
{
"name": "Customer",
"rows": 50,
"fields": [
{
"name": "id",
"type": "id",
"unique": true
},
{
"name": "name",
"type": "person.fullName"
}
]
},
{
"name": "Order",
"rows": 200,
"fields": [
{
"name": "id",
"type": "id",
"unique": true
},
{
"name": "customer_id",
"ref": "Customer.id"
},
{
"name": "amount",
"type": "finance.amount",
"min": 5,
"max": 900
}
]
}
]
}Customer is built first because Order points at it.
Common questions
Do I have to set rows on every table?
No. A table without rows takes the run default — 100 from the CLI, or what --rows sets. A table that states its own count keeps it, whatever the flag says.
What order are tables generated in?
Parents before children. The engine reads ref fields to find the dependency order, so a foreign key always points at a row that already exists.