Open-source React library

Every state source, in concert.

Most React apps keep state in four places at once: the server cache, component state, the URL and localStorage. Symphony State leaves each of them where it is and commits their updates together, so a screen never shows half of a change.

npm install @shiftbloom-studio/symphony-state

conductor.tsTypeScript
const filters = createUrlParamsAdapter(warehouseParams);
const stock = createQueryAdapter({ queryClient, queryKey: ["stock"] });
const selection = createAtomAdapter<string[]>([]);

const conductor = createConductor({
  sections: [
    defineSection({ key: "filters", source: filters }),
    defineSection({ key: "stock", source: stock }),
    defineSection({ key: "selection", source: selection }),
  ],
  derived: [
    defineDerivedSection({
      key: "lowStock",
      inputs: ["stock"],
      compute: (items) => items.filter((item) => item.qty < 20),
    }),
  ],
});

What the conductor commits

filters
⬢url
warehouse=hamburg
stock
⬡server
24 items, fetched 2s ago
selection
◈ui
3 rows
lowStock
△derived
2 items
React 19 · TypeScript · AGPL-3.0-or-later

Architecture / 01

Your stores stay where they are.

You keep TanStack Query, your component state and your URL params. Symphony State only sits between them: it collects their updates, applies them in dependency order and hands React one consistent snapshot.

  1. 01Server cacheTanStack Query / SWR
  2. 02UI stateLocal component state
  3. 03URL paramsSearch params / routing
  4. 04PersistencelocalStorage / IndexedDB

Conductor

Symphony State

Stage, reconcile, derive, commit

Given the same updates, it commits the same result.

Four independent inputsOne commit per change

Live demo / 02

Watch a change go through

Four short steps. Each one changes a single source, and the score on the right shows what the conductor did with it.

01
02
03
04

Type 'usb' in the filter field

Typing updates the URL state, and the derived list recomputes right away. Without a conductor that would be two separate setState calls. Here it is one transaction.

⬢url
◈ui
⬡server
Wireless Headphones△derived
USB-C Hub△derived
Mechanical Keyboard△derived
4K Webcam△derived
Portable SSD△derived
Smart Speaker△derived
Monitor Arm△derived
Standing Desk△derived

Score

0 events

This panel logs each transaction and each recomputed value. In your own app the Symphony DevTools show the same log.

Guarantees / 03

What you can rely on

  1. 01

    Orchestration, not ownership

    Each source keeps its store. Symphony State coordinates reads, writes, and conflict resolution across all of them.

  2. 02

    Single-wave commits

    Updates are staged, dependency-ordered, and committed atomically. Components never see a state that is only half updated.

  3. 03

    Observable state

    Every value remembers where it came from. The DevTools panel shows which source won a conflict and why.

  4. 04

    Composable adapters

    Atom, Zustand, Redux, TanStack Query, and URL params plug into the stores you already use. You don't have to migrate anything first.

  5. 05

    Explicit precedence

    Priority, freshness, staleness, and custom rules resolve conflicts between server, optimistic, and persisted state.

  6. 06

    Quiet rendering

    Subscribers are notified only for touched sections. Components whose state did not change stay untouched.

Get started / 04

Try it on a real screen before you add it to yours.

The inventory demo wires 24 products to a slow, sometimes wrong server, filters in the URL and a selection that survives reloads. Break it on purpose and watch how it recovers. The code is on GitHub, and issues and pull requests are welcome.