On the frontend, state often lives in one package, data fetching in another, routing in a third, with useEffect hooks and loading flags holding them together. Effect 4.2 introduces Effect UI, an experimental library that brings Effect's typed backend model to user interfaces.
Why Effect moved to the frontend and how mini-Elm works
Effect has long been known on the backend for typed errors, task cancellation, and Layer dependency injection. Foldkit tested that model on the frontend; now its author, Devin Jameson, has joined the Effect team and merged the code straight into effect@^4.2.0 with zero external dependencies.
It follows The Elm Architecture (TEA): a Model, typed Message events, a pure update, and view. Every component acts as an isolated "mini-Elm"—props flow down, messages flow up, and one failing widget won't crash the rest. Side effects like timers become Commands that the runtime runs and feeds back as messages:
import { Command, UiSchema } from "effect/ui"
import { Button } from "effect/ui/kit"
import { Html } from "effect/ui/html"
import { Effect, Schema } from "effect"
// Component events defined as a strict schema
const CounterMessage = UiSchema.TaggedEnum({
ClickedAdd: { amount: Schema.Number },
ClickedResetAfterDelay: {},
CompletedDelayReset: {},
})
// Command runs an effect and dispatches a message when done
const DelayReset = Command.make("DelayReset", {}, () =>
Effect.sleep("1 second").pipe(
Effect.as(CounterMessage.CompletedDelayReset()),
),
)
export const Counter = Html.component({
name: "Counter",
model: Schema.Struct({ count: Schema.Number }),
message: CounterMessage,
}).make({
init: () => ({ count: 0 }),
update: {
ClickedAdd: ($, { amount }) =>
$.evolve({ count: (count) => count + amount }),
ClickedResetAfterDelay: ($) => $.run(DelayReset.make()),
CompletedDelayReset: ($) => $.evolve({ count: 0 }),
},
view: (h, model) => {
const isResetting = h.isRunning(DelayReset)
return h.div(
h.output(String(model.count)),
Button(h, {
onPress: CounterMessage.ClickedAdd({ amount: -1 }),
}).children("-1"),
Button(h, {
onPress: CounterMessage.ClickedAdd({ amount: 1 }),
}).children("+1"),
Button(h, {
props: { disabled: isResetting },
onPress: CounterMessage.ClickedResetAfterDelay(),
}).children(isResetting ? "Resetting..." : "Reset in 1s"),
)
},
})
You don't need a separate isResetting flag in your model—h.isRunning(DelayReset) tracks it for you. Under the hood (packages/effect/src/ui), a component-scoped Virtual DOM only recalculates the component that received a message and skips child subtrees with unchanged props.
Batteries included across three platforms
Effect UI ships a full stack built on shared Schema and Layer primitives. The router validates path and query params with schemas and swaps cleanly between browser, server, and tests via layers. Query caching (Query.Service and Query.StreamService) supports debounce, staleTime, auto-cancellation, WebSockets/SSE, optimistic updates, and SSR sharing HttpApi.
Built-in effect/ui/kit (see ui.effect.website) packs 55 modules: 48 headless accessible components with focus management (calendars, date pickers, virtual lists) and 6 primitives. Play tests run in memory with TestClock, Story.explore hunts down command race conditions, and DevTools includes time-travel plus an MCP server for AI agents.
Rendering targets swap via a Host layer. Web (effect/ui/html) covers DOM, SSR, and Web Components. @effect/ui-opentui renders to terminals via OpenTUI, and @effect/ui-native drives iOS, Android, and macOS UI through React Native Fabric without React itself.
Benchmarks, bundle size, and experimental status
The code carries @stability unstable: APIs may shift in 4.x minor releases, and the preview docs still show older @effect/ui imports instead of effect/ui.
JS execution time in js-framework-benchmark (lower is faster)
Its custom VDOM beats React and sits near Vue, though Svelte and Solid stay faster. The built-in runtime costs 52.8 KB gzipped (around React's footprint) with a 381 ms first paint. Its early stage shows on large codebases too: migrating a 100K-line app from Foldkit trimmed 100 KB off the initial bundle, yet needed 9 workarounds.
It's too early for production—there are no third-party design systems yet, mobile and terminal hosts are separate, and you need to know Effect and Layer. If your backend already runs Effect, though, npm install effect@^4.2.0 is worth a spin in a side project for end-to-end types.





