SoulState
DAG-Powered State Management
DAG-powered state management with surgical reactivity, computed state, and transactions. Built for applications with complex dependency graphs and high subscriber counts.
Built for Performance
DAG-Powered Reactivity
Surgical Invalidation
Reverse-dependency graph traces only affected subscribers. Changing 1 key in a 1,000-key store touches nothing else.
Computed State
Memoized, dependency-aware computed nodes with deep propagation. Stale values recompute topologically — no glitches.
Transactions
Batch multiple mutations into a single atomic propagation cycle. Rollback support for failed operations.
Get Started in 60 Seconds
1. Install
npm install soulstate
2. Create Store with Computed State
import { createStore } from 'soulstate';
export const counterStore = createStore({
count: 0,
increment: () =>
counterStore.setState(s => ({ count: s.count + 1 })),
});
const doubled = counterStore.computed(
s => s.count * 2, 'doubled'
);
3. Use in React
import { useStore } from 'soulstate/react';
import { counterStore, doubled } from './store';
function Counter() {
const count = useStore(counterStore, s => s.count);
const double = useStore(counterStore, () => doubled.value);
const increment = useStore(counterStore, s => s.increment);
return (
<div>
<h1>{count} × 2 = {double}</h1>
<button onClick={increment}>+1</button>
</div>
);
}
Everything You Need
DAG Architecture
Directed acyclic graph for surgical invalidation and topological recomputation
Computed State
Memoized, dependency-aware derived state with glitch-free propagation
Transactions
Atomic multi-mutation batches with rollback support
Slices
Modular store composition with createSlice and combineSlices
Microtask Batching
Deterministic batching of all setState calls via microtask scheduler
Hybrid Dispatch
Bitmask fast path for ≤64 keys, graph path for complex updates
TypeScript First
Full type inference and safety with zero boilerplate
SSR Support
Next.js and server-side rendering ready out of the box
Middleware
Redux DevTools integration and persistence middleware included
Shallow Equality
Built-in shallow comparator and useShallow hook for fine-grained renders
Object Pools
Pre-allocated node and edge pools reduce garbage collection pressure
Vanilla JS
Full API surface works without React — no peer dependency required
How It Compares
| Benchmark | SoulState | Zustand | Ratio |
|---|---|---|---|
| Sync throughput (ops/s) | 5.2M | 5.5M | 1.05x slower |
| No-op elimination (sparse) | 914x | baseline | 914x faster |
| Deep chain recomputation | 26x | baseline | 26x faster |
| Hybrid dispatch (≤64 keys) | 16.8x | baseline | 16.8x faster |
Ready to Build Faster?
Join developers who have made the switch to SoulState and experience the performance difference.
Start Building with SoulState