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
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
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.
- 01Server cacheTanStack Query / SWR
- 02UI stateLocal component state
- 03URL paramsSearch params / routing
- 04PersistencelocalStorage / IndexedDB
Conductor
Symphony State
Stage, reconcile, derive, commit
Given the same updates, it commits the same result.
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.
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.
Score
0 eventsThis 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
- 01
Orchestration, not ownership
Each source keeps its store. Symphony State coordinates reads, writes, and conflict resolution across all of them.
- 02
Single-wave commits
Updates are staged, dependency-ordered, and committed atomically. Components never see a state that is only half updated.
- 03
Observable state
Every value remembers where it came from. The DevTools panel shows which source won a conflict and why.
- 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.
- 05
Explicit precedence
Priority, freshness, staleness, and custom rules resolve conflicts between server, optimistic, and persisted state.
- 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.