Skip to content

docs(domain): recommend Effect UI, and build the tutorial and examples on it - #3839

Open
sam-goodwin wants to merge 25 commits into
mainfrom
t3/domain-docs-effect-ui
Open

sam-goodwin wants to merge 25 commits into
mainfrom
t3/domain-docs-effect-ui

Conversation

@sam-goodwin

Copy link
Copy Markdown
Member

Stacked on #3798 (its rebased branch, mirrored as stack/domain-effect-ui). Retarget to main once #3798 merges.

Effect UI is now the recommended Domain frontend, with a page per framework under Frontends: a new Frontends overview, Effect UI, and Foldkit, which stays supported.

import * as DomainEffectUI from "@alchemy.run/domain/EffectUI";

export const BankUI = DomainEffectUI.make(BankApi);

// a component tests like an aggregate: messages in, Commands out
const s = yield* Story.make(BankNoDeps, { customerId });
s.send(BankMessage.ClickedOpen()).expectExact(BankUI.RegisterCustomer);
  • Tutorial part 6 builds the bank UI with Effect UI, and adds a Test the app step with Stories and Scenes. Part 7's browser tracing follows. Its code is now backed by a fixture, test/Domain/tutorial-bank, with the tutorial's Api, the app, its entry, and TutorialBank.test.ts.
  • examples/cloudflare-domain-better-auth is an Effect UI app: a Notebook reads the Notes View as a query, and WriteNote comes from the adapter.
  • examples/cloudflare-domain keeps its local-first behavior on Effect UI:
    • HtmlSubscription.onConnectivity replaces the hand-rolled online/offline listeners.
    • Deliver is a queued Command.Service over the adapter's own DepositMoney and WithdrawMoney.
    • History is a child component on the paged AccountLedger query.
  • Better Auth, local first and optimistic updates now embed those examples' own files. Optimistic updates leads with the adapter's built-in cache patch.
  • The alchemy-domain skill's frontend reference puts Effect UI first. Tracing and offline guidance is framework-neutral, and the Foldkit sections are kept.

artile and others added 8 commits November 27, 2026 19:34
> Clanked by Opus 5.5

Add the experimental subpath `@alchemy.run/domain/EffectUI`. It derives one
Effect UI `Command.Service` per Api command, one `Query.Service` per Api
query, and `watch`/`events` Subscriptions per View and Stream, with `layer`
implementing every service from the Api client. It mirrors the Foldkit
adapter: the same `Rejected`/`Denied`/`Unknown` failures, `CommandIds`,
`next` and `CommandHeaders`.

`@effect/ui` is not on npm yet, so the catalog pins a pkg.pr.new snapshot
of Effect-TS/ui. It is an optional peer of `@alchemy.run/domain`.
> Clanked by Opus 5.5

Look `CommandHeaders` up on each call instead of once per Layer build, so
a Command also finds headers provided beside `layer`. Document that
headers go under `layer`, because a query fetch can run outside the
component that asked for it.

Cover what the Foldkit suite covers: headers on each call reach the
client, a header defect is Unknown, a mid-stream validate refusal, Stream
reads with CaughtUp, interruption in feeds, query Denied, TimedOut and
Unknown, and the reserved `layer` name. Link the Foldkit sentence to the
Effect UI article.
> Clanked by Opus 5.5

`TestHost.settle` waits only for the fibers of the component tree, so a
client provided beside `TestHost` can leave the View stale under the
TestClock (Effect-TS/ui#411). The Play test now provides the adapter and
the in-process client through `Component.provide` and runs on
`it.effect`.

Document how to test a component with the model, add a test that a
query forwards `atLeast`, `take` and `CommandHeaders` to the client, and
say in the adapter that the context, not the headers, is captured once
per Layer build.
…ed queries

> Clanked by Opus 5.5

- A Command makes its own `commandId` (`NewCommandId`, a random UUID by
  default) and returns it in every success and failure; `CommandIds` and
  `next` are gone. Retry `Unknown` with the returned id.
- `commands.<Tag>.consistency` passes `consistency`; a strong command maps
  `ConsistencyTimeout` to a typed `TimedOut { commandId, receipt }`.
- `commands.<Tag>.invalidates`, `optimistic` and `writes` get the Api's
  queries. By default a command invalidates the queries whose `waitsFor`
  reads its events.
- Query args are `{ input }`. A query with `waitsFor` sends this client's
  receipts as `atLeast`, outside the cache key, until alchemy#3800.
- A paged query is a `Query.InfiniteService` (`queries.<Name>.key`, `take`).
- Per-call `headers` arg (Redacted), `watch` `restartKey`, and a View
  `SnapshotSchema` / `decodeSnapshot` for the first paint.
…ver render

> Clanked by Opus 5.5

Document the new adapter API, restarting a live read after the session
ends, seeding the first paint, and request-scoped server renders. List
domain/effect-ui in the llms.txt sections, so docs:generate passes.
> Clanked by Opus 5.5

Each Api View is now a Query.StreamService keyed by { key }. A stream
starts with snapshot(key) and this client's receipts as atLeast, then
follows watch(key), so a server render ships the first element and the
stream reopened after an optimistic run holds the write. Failures are
Rejected, Denied, TimedOut or Unknown. The watch and events
Subscriptions stay: watch as the lower-level Model copy, events as a
message feed. Bumps @effect/ui to the e0b7cec snapshot, which has
StreamService, and moves QueryOf to its Schema type parameters.
@alchemy-version-bot

alchemy-version-bot Bot commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

Install the packages built from this commit:

alchemy

pnpm install https://pkg.alchemy.run/alchemy/pr:3839:d752bc2
@alchemy.run (36)
pnpm install https://pkg.alchemy.run/@alchemy.run/better-auth/pr:3839:d752bc2
pnpm install https://pkg.alchemy.run/@alchemy.run/git/pr:3839:d752bc2
pnpm install https://pkg.alchemy.run/@alchemy.run/drizzle/pr:3839:d752bc2
pnpm install https://pkg.alchemy.run/@alchemy.run/acme/pr:3839:d752bc2
pnpm install https://pkg.alchemy.run/@alchemy.run/archil/pr:3839:d752bc2
pnpm install https://pkg.alchemy.run/@alchemy.run/boat/pr:3839:d752bc2
pnpm install https://pkg.alchemy.run/@alchemy.run/axiom/pr:3839:d752bc2
pnpm install https://pkg.alchemy.run/@alchemy.run/doppler/pr:3839:d752bc2
pnpm install https://pkg.alchemy.run/@alchemy.run/infisical/pr:3839:d752bc2
pnpm install https://pkg.alchemy.run/@alchemy.run/1password/pr:3839:d752bc2
pnpm install https://pkg.alchemy.run/@alchemy.run/turso/pr:3839:d752bc2
pnpm install https://pkg.alchemy.run/@alchemy.run/convex/pr:3839:d752bc2
pnpm install https://pkg.alchemy.run/@alchemy.run/e2b/pr:3839:d752bc2
pnpm install https://pkg.alchemy.run/@alchemy.run/daytona/pr:3839:d752bc2
pnpm install https://pkg.alchemy.run/@alchemy.run/modal/pr:3839:d752bc2
pnpm install https://pkg.alchemy.run/@alchemy.run/planetscale/pr:3839:d752bc2
pnpm install https://pkg.alchemy.run/@alchemy.run/neon/pr:3839:d752bc2
pnpm install https://pkg.alchemy.run/@alchemy.run/prisma/pr:3839:d752bc2
pnpm install https://pkg.alchemy.run/@alchemy.run/hetzner/pr:3839:d752bc2
pnpm install https://pkg.alchemy.run/@alchemy.run/digitalocean/pr:3839:d752bc2
pnpm install https://pkg.alchemy.run/@alchemy.run/railway/pr:3839:d752bc2
pnpm install https://pkg.alchemy.run/@alchemy.run/fly/pr:3839:d752bc2
pnpm install https://pkg.alchemy.run/@alchemy.run/github/pr:3839:d752bc2
pnpm install https://pkg.alchemy.run/@alchemy.run/stripe/pr:3839:d752bc2
pnpm install https://pkg.alchemy.run/@alchemy.run/cloudflare/pr:3839:d752bc2
pnpm install https://pkg.alchemy.run/@alchemy.run/gcp/pr:3839:d752bc2
pnpm install https://pkg.alchemy.run/@alchemy.run/aws/pr:3839:d752bc2
pnpm install https://pkg.alchemy.run/@alchemy.run/domain/pr:3839:d752bc2
pnpm install https://pkg.alchemy.run/@alchemy.run/kubernetes/pr:3839:d752bc2
pnpm install https://pkg.alchemy.run/@alchemy.run/docker/pr:3839:d752bc2
pnpm install https://pkg.alchemy.run/@alchemy.run/redis/pr:3839:d752bc2
pnpm install https://pkg.alchemy.run/@alchemy.run/sql/pr:3839:d752bc2
pnpm install https://pkg.alchemy.run/@alchemy.run/cloudflare-runtime/pr:3839:d752bc2
pnpm install https://pkg.alchemy.run/@alchemy.run/frontend-frameworks/pr:3839:d752bc2
pnpm install https://pkg.alchemy.run/@alchemy.run/node-utils/pr:3839:d752bc2
pnpm install https://pkg.alchemy.run/@alchemy.run/pkg/pr:3839:d752bc2
Transitive Dependencies (30)
pnpm install https://pkg.alchemy.run/@distilled.cloud/aws/pr:3839:d752bc2
pnpm install https://pkg.alchemy.run/@distilled.cloud/acme/pr:3839:d752bc2
pnpm install https://pkg.alchemy.run/@distilled.cloud/archil/pr:3839:d752bc2
pnpm install https://pkg.alchemy.run/@distilled.cloud/core/pr:3839:d752bc2
pnpm install https://pkg.alchemy.run/@distilled.cloud/boat-dev/pr:3839:d752bc2
pnpm install https://pkg.alchemy.run/@distilled.cloud/axiom/pr:3839:d752bc2
pnpm install https://pkg.alchemy.run/@distilled.cloud/doppler/pr:3839:d752bc2
pnpm install https://pkg.alchemy.run/@distilled.cloud/infisical/pr:3839:d752bc2
pnpm install https://pkg.alchemy.run/@distilled.cloud/turso/pr:3839:d752bc2
pnpm install https://pkg.alchemy.run/@distilled.cloud/convex/pr:3839:d752bc2
pnpm install https://pkg.alchemy.run/@distilled.cloud/e2b/pr:3839:d752bc2
pnpm install https://pkg.alchemy.run/@distilled.cloud/daytona/pr:3839:d752bc2
pnpm install https://pkg.alchemy.run/@distilled.cloud/modal/pr:3839:d752bc2
pnpm install https://pkg.alchemy.run/@distilled.cloud/planetscale/pr:3839:d752bc2
pnpm install https://pkg.alchemy.run/@distilled.cloud/neon/pr:3839:d752bc2
pnpm install https://pkg.alchemy.run/@distilled.cloud/s3/pr:3839:d752bc2
pnpm install https://pkg.alchemy.run/@distilled.cloud/prisma/pr:3839:d752bc2
pnpm install https://pkg.alchemy.run/@distilled.cloud/hetzner/pr:3839:d752bc2
pnpm install https://pkg.alchemy.run/@distilled.cloud/digitalocean/pr:3839:d752bc2
pnpm install https://pkg.alchemy.run/@distilled.cloud/railway/pr:3839:d752bc2
pnpm install https://pkg.alchemy.run/@distilled.cloud/fly-io/pr:3839:d752bc2
pnpm install https://pkg.alchemy.run/@distilled.cloud/github/pr:3839:d752bc2
pnpm install https://pkg.alchemy.run/@distilled.cloud/stripe/pr:3839:d752bc2
pnpm install https://pkg.alchemy.run/@distilled.cloud/aws4signer/pr:3839:d752bc2
pnpm install https://pkg.alchemy.run/@distilled.cloud/cloudflare/pr:3839:d752bc2
pnpm install https://pkg.alchemy.run/@distilled.cloud/iceberg/pr:3839:d752bc2
pnpm install https://pkg.alchemy.run/@distilled.cloud/gcp/pr:3839:d752bc2
pnpm install https://pkg.alchemy.run/@alchemy.run/effect-cluster/pr:3839:d752bc2
pnpm install https://pkg.alchemy.run/@alchemy.run/rivet/pr:3839:d752bc2
pnpm install https://pkg.alchemy.run/@distilled.cloud/rivet/pr:3839:d752bc2

Published Dec 1, 2026, 12:41 AM UTC. Expires Dec 8, 2026, 12:41 AM UTC, extended while this pull request is open.

@sam-goodwin
sam-goodwin force-pushed the t3/domain-docs-effect-ui branch from afd0e73 to f788dc9 Compare November 28, 2026 04:38
@sam-goodwin
sam-goodwin force-pushed the t3/domain-docs-effect-ui branch from f788dc9 to 36c1316 Compare November 28, 2026 04:40
@sam-goodwin
sam-goodwin force-pushed the t3/domain-docs-effect-ui branch from 5680cd6 to c9977a6 Compare November 28, 2026 04:54
@sam-goodwin
sam-goodwin changed the base branch from stack/domain-effect-ui to main November 28, 2026 05:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants