CRUD / foldkit-crud
What it owns, and what it does not
| Fact | Owner |
|---|---|
| The records, and whether a save or delete is pending, applied or failed | Remote, in its store |
| What a record is: its members, labels and relations | the Entity |
| The drafts, and whether they are valid | the form |
| Which id is open or being asked about, and which request is this screen's | the editor or remover, in its slice of your Model |
| Which rows a list shows: search, sort, filters | your Model, as the query's input |
| What happens after a save or delete: navigate, close, a toast | your application, reading the piece's status |
| How it looks | you, or foldkit-mixins-crud and foldkit-mixins-form |
The mental model
your Model says what is on screen
──▶ each piece's `active`: what it requires of Remote
──▶ Data.wiring ──▶ Remote fetches and retains it
Remote's store ──▶ each piece reads it: a page, a value, a status ──▶ your view
the user acts ──▶ a Message ──▶ a piece's helper, or the editor's onOut
──▶ Data.mutate ──▶ Remote settles it ──▶ the status movesThe rule to remember: a piece loads only what its active requires, and only
if that active is wired. A piece that is not wired never loads, and nothing
reports it. Wiring a page gathers every piece's active so
none is left out.
Install
sh
pnpm add effect foldkit foldkit-crud foldkit-bundle foldkit-entity foldkit-form foldkit-remote foldkit-surface