Remote / Server-derived state
Worked examples and limits
examples/remoteis a workedentity → select → Data → App.surface → prefetch → refresh → query page → render → mutate → retaintrace against an in-process client, andexamples/kitchen-sinkruns the same path overfoldkit-remote-serverandfoldkit-remote-drizzle(a nested selection, the live hub, an optimistic insert confirmed in place, hydration, retention). Both are asserted line by line. The test suites remain the exhaustive executable specification:pnpm exec vitest run packages/remote/test packages/remote-server/test packages/remote-drizzle/test.examples/cloudflareruns the reads on a Worker:serveFetchover D1, and a live stream that re-reads D1 from inside the subscriber's own request, because one worker request cannot wake another's stream. The Pages list writes through Remote mutations (foldkit-entity,foldkit-form,foldkit-crud) and paints them before the POST returns.- The transport is Effect RPC and nothing else; a wire change is a protocol
version bump (
REMOTE_PROTOCOL_VERSION), and a request is bounded in fields per entity, relation depth, and ids per entity. - Coalescing is per
RemoteClientlayer, and retention keeps what the active Surfaces reach (Data.subscriptions) orRemote.retainlists. - The live hub subscribes the requirements' own entities, not nested relation targets; a change to a target reaches a subscriber through its own requirement or a refetch.
See the APIs
The package READMEs document the full surface:
foldkit-surface,
foldkit-remote,
foldkit-remote-server, and
foldkit-remote-drizzle. The worked trace is in
examples/remote.