# Sorus > Sorus — reactive state that’s hard to get wrong. Synchronous state for domain models, built so the usual state bugs cannot happen and the rest fail where you, or your agent, can see them. Sorus is observable state for TypeScript and React. `@frondruntime/sorus` and `@frondruntime/sorus-react` import nothing from Effect; Effect Schema support is the separate, opt-in package `@frondruntime/sorus-effect`. Each link points to the Markdown source of a documentation page; the HTML page is at the same URL without `.md` (without `/index.md` for a section page). ## Start - [Start](https://sorus.frondruntime.dev/docs/start/index.md): Read when starting with Sorus. Install it, make a realm, boxes, and a computed value for a chat's composer, write in an update, and show the value in React. - [Why Sorus](https://sorus.frondruntime.dev/docs/start/why.md): Read when deciding whether Sorus fits, or when one of its rules looks arbitrary. The claims behind its design, what each costs, when to pick it, and which package holds what. - [Coming from MobX](https://sorus.frondruntime.dev/docs/start/mobx.md): Read when moving an app from MobX. The chat's composer as a MobX store and as a Sorus model, the Sorus call for each MobX one, and the habits that do not carry over. ## State - [Realms](https://sorus.frondruntime.dev/docs/state/realms.md): Read when deciding where state lives and when it ends. Make a realm, keep each observable to the realm that made it, see where errors with no caller go, and dispose a realm. - [Boxes and computed](https://sorus.frondruntime.dev/docs/state/boxes.md): Read when declaring state. Make a box, derive a cached computed value, make one per argument, stand for outside state with an atom, and read a value outside an update. - [Updates](https://sorus.frondruntime.dev/docs/state/updates.md): Read when writing state. Write boxes and rows in one update, draft arrays and objects, await before an update, rely on an update being undone when it throws, and run effects after it ends. - [Collections](https://sorus.frondruntime.dev/docs/state/collections.md): Read when state holds rows by key. Make a keyed collection, write and read rows, render one row per key, keep a value a row at a time, and choose between a collection and a box of an array. - [Views](https://sorus.frondruntime.dev/docs/state/views.md): Read when a list sorts or filters a collection, or a value follows a collection by group. Make a sorted, filtered order, the keys of each group, or a count and total per group, kept a row at a time. ## Async work - [Stages](https://sorus.frondruntime.dev/docs/state/stages.md): Read when asynchronous work writes only if it succeeds, or shows its writes before the server answers. Hold the writes in a stage, land them in one update or discard them, refuse a landing when what it read changed, and show an optimistic write that a failure takes off. - [Live data](https://sorus.frondruntime.dev/docs/guides/live-data.md): Read when state comes from a socket or a server. Open a socket while a value is observed and reconnect after a drop, write each event in one update, refetch without losing row identity, and keep an aborted request from writing. - [Async state](https://sorus.frondruntime.dev/docs/guides/async-state.md): Read when a value comes from a request. Load a promise into a value while it is observed, map its failure into the value, and keep the status and retry policy in the request library. - [Lifecycles](https://sorus.frondruntime.dev/docs/state/lifecycles.md): Read when state comes from outside Sorus. Start a listener when a value gains its first observer and stop it after the last, stand for outside state with an atom, hold a value observed, and dispose a realm to end everything it runs. ## Reacting and history - [Reacting](https://sorus.frondruntime.dev/docs/state/reacting.md): Read when code outside React runs because a value changed. Watch a selection, run an autorun with a cleanup, and write from an autorun without a loop. - [Change stream](https://sorus.frondruntime.dev/docs/state/changes.md): Read when tools need every write as data. Listen to each landed update's record with Realm.onUpdate, and build undo and replay with write.revert and write.replay. - [Snapshots](https://sorus.frondruntime.dev/docs/state/snapshots.md): Read when state goes out as plain data and comes back. Declare a shape of boxes and collections, read it with read.snapshot, and write it back with write.restore. - [Saving state](https://sorus.frondruntime.dev/docs/guides/saving.md): Read when state outlives a reload. Save a computed projection of what to keep, restore before the watch starts, write one save per burst, and save state a visible stage shows from the records of Realm.onUpdate. ## React - [Hooks](https://sorus.frondruntime.dev/docs/react/hooks.md): Read when showing the chat in React. Pick a hook, rerender less under memo, read in an event handler, keep a component's own state in a box, and defer a slow render after a write. ## Effect (opt-in) - [Schema-checked boxes](https://sorus.frondruntime.dev/docs/effect/boxes.md): Read when an app already uses Effect and needs a box or collection that checks an Effect Schema on every write. - [Classes](https://sorus.frondruntime.dev/docs/effect/classes.md): Read when modeling domain data. Declare a Model.Schema with box fields, derive values on it, write from its methods, decode it from the wire, and hand it the caller's own values, in a decode or an Effect program. - [Collection fields](https://sorus.frondruntime.dev/docs/effect/collections.md): Read when a model holds rows by key, or when a schema-checked box of an array is refetched whole. Declare a Model.collectionField, decode it from a plain array, and reconcile a refetch. - [Equality and hashing](https://sorus.frondruntime.dev/docs/effect/equality.md): Read when a write, a refetch, or a reconcile keeps or replaces a value. Shows what each box, collection, and reconcile compares with, when a refetched model is merged, and how a class defines its own Equal and Hash. - [Programs](https://sorus.frondruntime.dev/docs/effect/programs.md): Read when an app is written as Effect programs. Run an effect per change, stream changes, hold a value observed for a scope, feed a value from a stream, run a feed while its data is read, and hold a section's writes in a stage until it succeeds. ## When things go wrong - [Errors and debugging](https://sorus.frondruntime.dev/docs/guides/errors.md): Read when something throws or reruns unexpectedly. Know which errors reach the caller and which go to onError, find why a value recomputed with inspect, and tell errors apart. - [Testing](https://sorus.frondruntime.dev/docs/guides/testing.md): Read when writing tests. Make a test realm per test, record what a select changes to, check what a collection still holds, hold every stop in using, and test programs on TestClock. ## Reference - [Error messages](https://sorus.frondruntime.dev/docs/reference/errors.md): Read when Sorus throws or logs a message. Every message Sorus and sorus-effect throw or log, its _tag or code, what caused it, and the fix. ## More - [Agent skills](https://sorus.frondruntime.dev/docs/start/skills.md): Read when an agent writes code on Sorus. Install the agent skills, see which skill covers each task, and point an agent without skills at llms.txt. ## Optional - [Full documentation](https://sorus.frondruntime.dev/llms-full.txt): Every page above, concatenated into one file.