Remote / An event-sourced domain behind Remote
An event-sourced domain behind Remote
Some backends keep every change as a recorded event ("stock reserved", "order placed") and build the rows readers see from those events. That history is valuable, but it makes the page harder: a read straight after a write can come from a read model that has not caught up, and the page still needs optimistic updates, refusals and permissions that agree with the server.
Alchemy Domain (@alchemy.run/domain) is an
event-sourcing library for Effect, separate from Foldkit Plus. In its words: a
Command asks for a change, an Aggregate decides it and records
Events, a View folds Events into a read model, and an Api lists
what clients may send and read.
foldkit-remote-domain puts such a
model behind Remote, Foldkit Plus's package for server data. The
page reads Views and sends Commands as it reads and writes any server, and the
records and rules you declared with foldkit-entity mean the same
thing on both sides. This guide is about how the two fit; the package README is
the reference.
The package is experimental and pins one beta of Domain (2.0.0-beta.86).