v0 · Developer PreviewBefore 1.0, with one application built on it so far. The API may change between releases; a migration ships as a codemod.
$done$label<Row>Write the docs×$done$label<Row>✓ Ship the site×$done$label<Row>Measure Hermes×$done$label<Row>✓ Run conformance×$done$label<Row>Check the tarba…×$done$label<Row>✓ Bench on No…×$count6$left3$allDonefalse$todosrealm

toggle() writes one $done → $label recomputed once → one <Row> of six re-rendered. Tap a todo to toggle it; × removes it.

Reactive statethat’s hardto get wrong.

Sorus is glitch-free reactive state for applications: granular reads and updates, cached derived values, and lifecycles driven by observation. One way to declare a model, one way to write, and an error instead of silent misuse.

@frondruntime/sorus and @frondruntime/sorus-react import nothing from Effect; Effect Schema support is a separate, opt-in package.

the graph above, as code: a realm, a box, a computed value, an update, and a row
import { Box, Computed, Realm } from "@frondruntime/sorus";
import { useValue } from "@frondruntime/sorus-react";
import { memo } from "react";
import { ListItem } from "./ui.tsx";

const realm = Realm.make(); // the stem: every value below lives in it

function makeTodo(id: string, title: string) {
  const $done = Box.make(realm, false); // a box: the square
  // A computed value, the diamond: `read` subscribes, so it recomputes only after $done changes.
  const $label = Computed.make(realm, (read) => (read($done) ? `✓ ${title}` : title));
  return { id, $done, $label };
}
type Todo = ReturnType<typeof makeTodo>;

// A box changes only inside Realm.update; a write anywhere else throws.
const toggle = (todo: Todo) =>
  Realm.update(realm, (read, write) => write(todo.$done, !read(todo.$done)));

// A row reads its own $label, so a toggle re-renders one <Row> of six.
const Row = memo(({ todo }: { readonly todo: Todo }) => (
  <ListItem onPress={() => toggle(todo)}>{useValue(todo.$label)}</ListItem>
));
principles

The principles.

Six rules shape the API; the principles page explains why.

Why Sorus
  1. 01

    Glitch-free by construction.

    A write pushes marks; a read pulls and validates. A derived value checks its sources' versions before it recomputes, and watchers run after the write settles, so no reader sees a half-applied update.

  2. 02

    Reads are explicit.

    What can change is an observable, named with a leading $; everything else is plain data. Every place that reads hands its function a read, and read($x) returns the value and subscribes that place.

  3. 03

    Writes are bounded.

    A box changes only inside Realm.update, through the write it hands out. An update is atomic: one that throws is undone, and watchers run once, when it ends. A kept write throws.

  4. 04

    Misuse is loud.

    A write outside Realm.update, or an update started in a computed value, a watch's select, or a selector, throws and says where to write instead. So does a read of another realm's observable.

  5. 05

    Observation is a lifecycle.

    A source is live while something observes it. Source.onObserved is the one hook for starting and stopping work: it starts with the first observer, and its cleanup runs when the last one leaves.

  6. 06

    The graph imports nothing.

    @frondruntime/sorus-core has no runtime dependencies. sorus and sorus-react import nothing from Effect; only the opt-in sorus-effect does, so an application without Effect never loads it.

A read says it is a read.

An observable is not its value. A computed value reads through read, a component through a hook; math or a comparison on the observable itself is a type error.

a computed value, and two that forgot read
import { Box, Computed } from "@frondruntime/sorus";

const $price = Box.make(realm, 12);
const $quantity = Box.make(realm, 3);

// A computed value reads through read, and recomputes when either box changes.
const $total = Computed.make(realm, (read) => read($price) * read($quantity)); // 36

// A box used as its value
const $broken = Computed.make(realm, () => $price * $quantity);^^^^^^ type error TS2362if ($total > 30) {^^^^^^^^^^^ type error TS2365  notify();
}

A write has one place.

Boxes have no setters: only update hands out write. An update that throws is undone, so a half-finished change never becomes state.

an update, and the ones that fail
import { Box, Realm } from "@frondruntime/sorus";

const $count = Box.make(realm, 0);

// Only update hands out write.
Realm.update(realm, (read, write) => write($count, read($count) + 1));

// An await inside an update
Realm.update(realm, async (_read, write) => {^^^^^^^^^^^^^^^^^^^^^^^^^ type error TS2345, throws  await save();
  write($count, 2);
});

// An update that throws is undone: $count stays 1
Realm.update(realm, (_read, write) => {
  write($count, 5);
  throw new Error("stop");
});

State lives in a realm.

Sorus keeps no global state: a box answers only to the realm that made it. A call from another realm, or out of its place, throws and says where the call belongs.

two realms, and calls out of place
import { Box, Computed, Realm } from "@frondruntime/sorus";

// Each test or request creates its own realm, and a box answers only to the one that made it.
const app = Realm.make({ name: "app" });
const quotes = Realm.make({ name: "quotes" });
const $count = Box.make(app, 0);
const $price = Box.make(quotes, 0);

// An observable of another realm
Realm.update(app, (_read, write) => write($price, 1));^^^^^^ throws
// An update inside a computed value
const $double = Computed.make(app, (read) => {
  Realm.update(app, (_read, write) => write($count, 1));^^^^^^ throws  return read($count) * 2;
});
blocks

Building blocks.

Three packages. @frondruntime/sorus holds every block and knows neither React nor Effect; sorus-react and sorus-effect are opt-in layers over it. A call that makes an observable, opens an update, or starts a watcher takes the realm first; a call about one observable, such as useValue or Source.inspect, takes the observable.

Building blocks

Core@frondruntime/sorus

A state manager decides where state lives, then creates it, reads and observes it, and writes it. The sample uses @frondruntime/sorus alone.

  • Create

    A realm holds every observable it makes. Box.make holds a value, Computed.make derives one from what it reads, and Collection.make keeps rows by key.

    Building blocks
  • Read and observe

    read($x) returns the value and subscribes the place that reads it. Realm.watch and Realm.autorun rerun after a change, and Source.onObserved runs work while something reads.

    Reacting
  • Write

    write exists only inside Realm.update, so a change is a function that calls it, from a handler or a watch. An update that throws is undone.

    Updates
the five jobs
import { Box, Computed, Realm, Source } from "@frondruntime/sorus";
import { useValue } from "@frondruntime/sorus-react";

// Realm: where state lives. A test or a request creates its own.
const realm = Realm.make();

// Create: a box holds state, a computed value derives from it.
const $count = Box.make(realm, 0);
const $double = Computed.make(realm, (read) => read($count) * 2);

// Read: a component reads through a hook. No hook, no read.
function Counter() {
  const double = useValue($double);
  return (
    <button type="button" onClick={increment}>
      {double}
    </button>
  );
}

// Write: write exists only inside update.
function increment() {
  Realm.update(realm, (read, write) => write($count, read($count) + 1));
}

// Observe: watch runs when the value it selects changes,
// autorun when anything it read changes. Each returns its stop.
const stop = Realm.watch(
  realm,
  (read) => read($double),
  (double) => {
    document.title = String(double);
  },
);
const stopLog = Realm.autorun(realm, (read) => void console.log(read($double)));

// Start work: when the first observer arrives,
// and return what stops it when the last one leaves.
// This one counts up each second while something reads $count.
Source.onObserved($count, () => {
  const timer = setInterval(increment, 1000);
  return () => clearInterval(timer);
});

Reactopt-in@frondruntime/sorus-react

Components read through hooks, and no component is wrapped. Each feature below works with plain hooks and has a test.

  • React Compiler

    Components compiled with babel-plugin-react-compiler stay current, even one that hands its model to a helper. Reads live inside hooks, so the compiler is free to memoize the rest.

    compiler.test.tsx
  • Strict Mode

    Hooks subscribe through useSyncExternalStore. Strict Mode renders and mounts twice, and leaves no extra subscription behind: work started for the first observer stops after the last one.

    react.test.tsx
  • Server rendering

    Each request creates its own realm and hands it to RealmProvider. A server render reads values and observes nothing.

    react.test.tsx
a provider, a hook read, and a write from a handler
import { Box } from "@frondruntime/sorus";
import { RealmProvider, useValue } from "@frondruntime/sorus-react";
import { StrictMode } from "react";
import { createRoot } from "react-dom/client";
import { realm, type Todo, todos, toggle } from "./todo.tsx";

// Plain components, no wrapper: a hook reads, and React Compiler memoizes the rest.
function TodoRow({ todo }: { readonly todo: Todo }) {
  const label = useValue(todo.$label);
  // A write is a function, called from a handler like any other.
  return (
    <li>
      <button type="button" onClick={() => toggle(todo)}>
        {label}
      </button>
    </li>
  );
}

function TodoList({ $todos }: { readonly $todos: Box<ReadonlyArray<Todo>> }) {
  const todos = useValue($todos);
  return (
    <ul>
      {todos.map((todo) => (
        <TodoRow key={todo.id} todo={todo} />
      ))}
    </ul>
  );
}

// The provider hands down a realm: a server request or a test creates its own.
function mount(container: HTMLElement) {
  createRoot(container).render(
    <StrictMode>
      <RealmProvider realm={realm}>
        <TodoList $todos={$todos} />
      </RealmProvider>
    </StrictMode>,
  );
}

Effectopt-in@frondruntime/sorus-effect

For an application already on Effect: models on Effect Schema, and programs that stop with their scope. Every other sample on the page uses sorus and sorus-react, which import nothing from Effect; an application without Effect never installs it.

Sorus for Effect
  • A model is a Model.Schema.

    An Effect Schema.Class whose $ fields are boxes that check every write (Model.boxField) or collections that check each row (Model.collectionField). Model.decode(realm, schema)(input) makes one from wire data, and it encodes back.

    mix.test.ts
  • The realm is a service.

    Model.decode hands the realm to what it makes as RealmService, and programs read the same service.

    effect.test.ts
  • Programs stop with their scope.

    Program.watchScoped runs an effect on each change, Program.fromStream turns a stream into a value, and both stop when their scope closes.

    effect.test.ts
a model, a checked write, and a program
import { Model, Program, Realm, RealmService } from "@frondruntime/sorus-effect";
import { Effect, Layer, Schema } from "effect";

// One class decodes server data, checks every write to its box fields, and encodes back.
class Order extends Model.Schema<Order>("Order")({
  id: Schema.String,
  $quantity: Model.boxField(Schema.Int.check(Schema.isGreaterThanOrEqualTo(0))),
}) {}

const realm = Realm.make();
const order = Model.decode(realm, Order)({ id: "7", quantity: 2 });
Schema.encodeSync(Order)(order); // { id: "7", quantity: 2 }

// A value the schema refuses throws a ValueRejectedError to the caller, with the
// Schema.SchemaError as its cause, and the update is undone.
try {
  Realm.update(realm, (_read, write) => {
    write(order.$quantity, -1);
  });
} catch (error) {
  console.error(error);
}

// A program stops with its scope: this one saves each change until the fiber is interrupted.
const save = Program.watchScoped(
  realm,
  (read) => read(order.$quantity),
  (quantity) => saveQuantity(order.id, quantity),
);
const fiber = Effect.runFork(
  save.pipe(
    Effect.andThen(Effect.never),
    Effect.scoped,
    Effect.provide(Layer.succeed(RealmService, realm)),
  ),
);
more

And more.

Blocks the core sample leaves out, all in @frondruntime/sorus. The docs cover each one and the rest.

  • Views

    View.ordered, View.grouped, and View.totals keep an order, groups, and totals over a collection. A write to one row moves that row; nothing sorts or sums again.

    Views
    a sorted order and a window
    import { Collection, View } from "@frondruntime/sorus";
    
    const $orders = Collection.make(realm, {
      keyOf: (order: Order) => order.id,
    });
    
    // Largest first. A write to one row
    // moves that row's key, not all of them.
    const $byAmount = View.ordered($orders, {
      compare: () => (left, right) =>
        right.cents - left.cents,
    });
    
    // The keys a scrolled list shows.
    const $visible = $byAmount.range(0, 20);
  • Stages

    A stage holds the writes of a request. Stage.apply lands them in one update; Stage.drop discards them, so a failed request leaves nothing to undo.

    Stages
    writes that wait for a request
    import { Stage } from "@frondruntime/sorus";
    
    // A request's writes wait until it succeeds.
    async function place(order: Order) {
      const stage = Stage.make(realm, { name: "place" });
      try {
        Stage.update(stage, (_read, write) =>
          write.upsert($orders, order),
        );
        await send(order);
        Stage.apply(stage); // lands in one update
      } finally {
        Stage.drop(stage); // a failure leaves nothing
      }
    }
  • Testing

    Testing.testRealm makes a realm per test and throws at its end if a watch still runs. Testing.record keeps each value a select changed to.

    Testing
    a test realm and a recording
    import { expect, test } from "bun:test";
    import { Box, Realm } from "@frondruntime/sorus";
    import * as Testing from "@frondruntime/sorus/testing";
    
    test("an increment records one change", () => {
      // Its dispose throws if a watch still runs.
      using realm = Testing.testRealm();
      const $count = Box.make(realm, 0);
      using changes = Testing.record(realm, (read) =>
        read($count),
      );
    
      Realm.update(realm, (read, write) =>
        write($count, read($count) + 1),
      );
    
      expect(changes.values).toEqual([1]);
    });
performance

Performance.

Tracking every read costs speed, and Sorus does not trade it away. The cost is held to a budget on Hermes, the engine React Native ships: the public layer within 2× of alien-signals' time, the graph core within 1.6×, and faster than MobX everywhere. The tables measure speed and memory for Sorus, alien-signals, Legend State, and MobX: in a React Native app on iOS, with the web and Android not measured yet, and for the graph alone on Bun, Node, and Hermes.

How it is measured

Lower is better. Each cell is colored against the best figure in its row on the same runtime.

  • best, or within 5% of it
  • within 1.5×
  • within 3×
  • within 10×
  • within 100×
  • within 1,000×
  • more than 1,000×, or stack overflow

Hover a cell for its ratio. A dash is not measured.

In a React Native app

Speed ms in the store

In a React Native app, speed: Sorus, alien-signals, Legend State, and MobX on Web, iOS, Android
ScenarioSorusalien-signalsLegend State (beta)MobX
WebiOSAndroidWebiOSAndroidWebiOSAndroidWebiOSAndroid
Load 10,000 rows—51——27——166——238—
Merge a refetch into them—252——229——332——285—
Replace them all—56——30——292——249—
Insert 100 rows—14——13——31——2.7—
Remove 100 rows—15——20——43——11—
60 ticks of 50 price changes—28——25——232——42—

Memory MB

In a React Native app, memory: Sorus, alien-signals, Legend State, and MobX on Web, iOS, Android
ScenarioSorusalien-signalsLegend State (beta)MobX
WebiOSAndroidWebiOSAndroidWebiOSAndroidWebiOSAndroid
Allocated by the load—8.5——15.4——29.1——115.9—
Garbage collections during the load collections—3——4——8——30—
Allocated by the 60 ticks—0.9——0.9——31.5——2.2—
Kept for the rows—43.5——42.3——45.9——51.9—

The graph alone

Speed ms

The graph alone, speed: Sorus, alien-signals, Legend State, and MobX on Bun, Node, Hermes
ScenarioSorusalien-signalsLegend State (beta)MobX
BunNodeHermesBunNodeHermesBunNodeHermesBunNodeHermes
Deep chain4.014.7475.62.763.5341.1257overflowoverflow17.815.1204
Fan-out8.418.031455.915.931022692421,83628.527.8507
Diamond6.266.041084.974.5656.22272191,58515.814230
Conditional reads21.824.341717.716.72596215463,4166662.61,164
Make and dispose2.042.4227.11.090.9613.146.869.829113.621.571.1
Write 1,000 sources6.797.031145.294.2485.210896.571018.618.4291
Bursty fan-out9.298.0914760.753.44947291,0814,19228.127.3494
Increment ×100,00012.116.12369.139.881473563171,94838.138579
One write among 10,0001.170.552.780.890.371.816.110.224.91.941.376.57

Memory allocated by one graph run KB

The graph alone, memory allocated by one graph run: Sorus, alien-signals, Legend State, and MobX on Bun, Node, Hermes
ScenarioSorusalien-signalsLegend State (beta)MobX
BunNodeHermesBunNodeHermesBunNodeHermesBunNodeHermes
Deep chain—1014—3,9257,845—overflowoverflow—39,24031,353
Fan-out—1014—147,845—394,184642,827—84,89088,380
Diamond—1014—187,852—373,314652,397—40,58332,979
Conditional reads—8,19010,957—7,83642,089—898,5391,462,496—176,559178,300
Make and dispose—11,08413,057—7,39011,652—118,060156,914—48,74331,116
Write 1,000 sources—1014—1017,983—244,663389,152—51,47164,935
Bursty fan-out—0.83—4.78,850—878,9871,753,886—76,33388,380
Increment ×100,000—9,47910,938—14,50136,722—742,6931,145,927—125,035128,911
One write among 10,000—178191—217448—8,68711,987—1,1631,372
How these were measured

Where they ran

The app on 2026-11-16, the graph on 2026-11-18.

The app
apps/rn-bench, a release build on Hermes on the iPhone 17 Pro simulator. 10,000 rows, full mode. Each figure is the median of three rounds.
The graph on Node and Hermes
sorus-bench's rough tier on Node 26.13.1 and on Hermes 260318099.0.5, the one React Native 0.88.1 ships, from the command line. One launch a cell, a process of its own that makes the library's instance once; a figure is the median of that launch's samples. The machine's load average was 1.6 to 3.7. Every library's watchers run the same effect, made once per process, which counts its calls, and every bundle is a production build.
The graph on Bun
bench:graph on Bun 1.4.4, the median of 9 runs, each library in a process of its own with NODE_ENV set to production.

What a figure counts

App speed
The synchronous write. Sorus and alien-signals rerun their readers inside it; MobX and Legend State rerun theirs in the render that follows, which is not timed.
Parsing
Left out. Every store takes plain values: JSON.parse and the conversion from wire JSON, 760 to 845 ms of each bulk write, are timed apart.
App memory
Hermes's own counters, the median of the three rounds.
  • Allocated: bytes allocated during the store's write alone, garbage included.
  • Kept: allocated bytes after two forced full garbage collections with the 10,000 rows loaded, minus the same with the store empty, read on a fresh screen after every timed scenario.
Graph memory
Kilobytes allocated by one run of each scenario, the median of the runs, from the same sorus-bench run as the speed figures.
  • Node: V8's total allocated bytes, in a launch of its own with --no-inline-new, 15 runs after 10 of warm-up.
  • Hermes: its count of allocated bytes, in the timed launches.
  • Bun: not measured.

The same for every library

One shape
Every store in the app keeps the same three fields of a row reactive, and all four share one list, one set of views, and one merge rule. The merge is mostly a comparison all four share.
One build
babel-preset-expo's defaults, tuned for none of them, and no store's rows extend a class. Under those defaults, making an instance of a class that extends another costs about 2.6 KB and 2.8 µs in Babel's callSuper helper.
Noise
Insert and remove vary up to 3× between rounds.

Each library

Sorus
Plain boxes, which check nothing, held in plain objects rather than Model subclasses. Its tick looks rows up through read.row, which makes nothing per key where nothing tracks.
alien-signals 3.2.1
In the app, through a React hook written for this app.
Legend State 3.0.0-beta.48
A beta. In the app, loaded in one set; its ticks are not profiled. In the graph, its deep chain overflows the stack on Node and Hermes.
MobX 7.1.7
It makes an ObservableValue, which extends Atom, per observable field, so it pays Babel's helper inside its own code: the app's load and replace take about 80 ms more, and the load 60 MB more, than MobX 6.15.3's ES5 build did. On Hermes from the command line, without Babel, 7.1.7 is the faster of the two.

Reproducing

Node and Hermes
bun run bench --tier publishIn packages/sorus-bench. Hermes needs a hermes-ios release, given with --hermes or SORUS_HERMES.
Bun
bun run --cwd packages/sorus bench:graph
The app
bun run --cwd apps/rn-bench iosthenbun run --cwd apps/rn-bench bench --mode full
conformance

Conformance.

Every suite runs in bun run test, and a gap that opens or closes fails the run.

reactive-framework-test-suite

161 cases, one square each, in suite order. reactive-framework-test-suite 0.2.0, MIT, Johnson Chu; shared-suite.

Sorus160 pass, 1 differs

MobX 7.1.7128 pass, 14 differ, 19 skip

alien-signals 3.2.1161 pass

  • pass
  • differs from the suite
  • skip

Sorus differs on case #154, which expects a batch that throws to keep its writes: an update that throws is undone.

29 probes record which valid design a library takes: Sorus answers every one. The design notes list each answer.

  • 20 of 20shared cases: diamonds, glitches, dynamic dependencies, batching, errorscases.ts
  • 200seeded random graphs, run on Sorus, MobX, and alien-signals and compared on notifications, values, and recomputesdifferential.test.ts
  • 11 filesof MobX as an application uses it, each case run on MobX and on Sorus, with every difference stated in the filesorussorus-effectsorus-reactagainst MobX 7.1.7
install

Install.

Each command saves to dependencies. The agent skills install with npx skills add frondruntime/sorus.

Getting started
  • Sorus

    No Effect, no React.

    the core
    bun add @frondruntime/sorus
    # or npm install, pnpm add, yarn add
  • + React

    sorus and React 19 or later are peer dependencies.

    with the hooks
    bun add @frondruntime/sorus \
      @frondruntime/sorus-react
    # or npm install, pnpm add, yarn add
  • + Effect

    sorus and effect 4.1 or a later 4.x are peer dependencies. An application without Effect never installs it.

    with Effect Schema, opt-in
    bun add @frondruntime/sorus \
      @frondruntime/sorus-effect effect
    # or npm install, pnpm add, yarn add