Relations, search & CSV

Three capabilities every entity page (records and every demo) gets for free, all driven by the same field config.

Relations (the ref field type)

A ref field points at another entity in the same app. It stores the target's id as a string and renders as a dynamic select whose options are the target rows — labels resolve at runtime via withRefOptions. The crm demo uses it: activities.contactId → contacts.

{ "key": "contactId", "label": "Contact", "type": "ref", "ref": "contacts", "refTitleKey": "name" }

With --fields, add one as key:ref:<targetTable>. Refs follow a --table rename of the primary entity.

Search + filters

useEntityFilters gives every page a search box over the title and text fields plus one FilterChips row per select field, with a live count. It is client-side over the rows already loaded — no config.

CSV import / export

  • Export: every row as CSV, header = field keys in config order (tags joined by |, position as x,y).
  • Import: pick a CSV; each cell is coerced by field type (numbers, booleans, tags, select-enum validation), rows without a valid title are reported, valid rows flow to your create mutation.
  • The field config IS the column mapping — no separate schema.