AsyncFlowStateThe AI-Powered Async Engine
Eliminate boilerplate, predict user intent, and self-heal failures with AI — across React, Vue, Svelte, Angular, Solid, Next.js, Nuxt, Remix & Astro.
Eliminate boilerplate, predict user intent, and self-heal failures with AI — across React, Vue, Svelte, Angular, Solid, Next.js, Nuxt, Remix & Astro.

The Problem
Every async action needs loading states, error handling, double-click prevention, and accessibility. AsyncFlowState handles all of it in one hook.
function SaveButton({ data }) {
const [loading, setLoading] = useState(false);
const [error, setError] = useState(null);
const [submitted, setSubmitted] = useState(false);
const handleClick = async () => {
if (loading) return; // manual double-click guard
setLoading(true);
setError(null);
try {
await api.save(data);
setSubmitted(true);
toast.success("Saved!");
} catch (err) {
setError(err.message);
toast.error(err.message);
} finally {
setLoading(false);
}
};
return (
<>
<button
onClick={handleClick}
disabled={loading}
aria-busy={loading}
aria-disabled={loading}
>
{loading ? "Saving..." : "Save"}
</button>
{error && <p role="alert">{error}</p>}
</>
);
}function SaveButton({ data }) {
const flow = useFlow(async () => api.save(data), {
onSuccess: () => toast.success("Saved!"),
onError: (err) => toast.error(err.message),
});
return (
<>
<button {...flow.button()}>{flow.loading ? "Saving..." : "Save"}</button>
{flow.error && (
<p ref={flow.errorRef} role="alert">
{flow.error.message}
</p>
)}
</>
);
}Core Engine — v3.0
30+ production-grade features. AI-powered debugging. Zero runtime dependencies. One API surface across nine frameworks.
Concurrency Control
Control overlapping requests with professional concurrency strategies. No more race conditions or manual isLoading flags.
Exhaust
Block while active
Switch
Cancel & restart
Enqueue
Process in order
Resilience
Automatic retry with exponential backoff, randomized jitter, and circuit breaker patterns. Failed operations recover without flooding your backend.
Backoff
Exponential delay
Jitter
Prevent stampedes
Circuit Breaker
Stop cascading
Instant UI updates with automatic rollback on failure. Users see results before the server responds.
Learn more →Purgatory state holds operations in limbo. Give users a grace period to undo before commit.
Learn more →Native AsyncIterable and ReadableStream support for AI chat, live feeds, and SSE.
Flow states sync across tabs via BroadcastChannel. One tab completes — all tabs update.
Learn more →Resume interrupted operations across page refreshes with localStorage/sessionStorage persistence.
Learn more →Add logging, analytics, auth-token injection, and request transforms with global or per-flow middleware.
Learn more →Real-time timeline/Gantt view of all async activity. Time-travel through state transitions for debugging.
Learn more →Genetic auto-tuning. Flows analyze P95 latency to continuously evolve their own optimal timeouts, retries, and stale times.
Learn more →Device-aware flows that monitor battery, network type, and CPU pressure to dynamically defer or compress payloads.
Learn more →Tabs form a local P2P network using BroadcastChannel. Leader election prevents duplicate API calls and shares cache instantly.
Learn more →✦ Next-Gen AI — Autonomous Async Orchestration ✦
See It In Action
Watch how exhaust, switch, and enqueue handle overlapping user clicks in real time. No custom logic required.
Resilience Engineering
Network failures are inevitable. AsyncFlowState retries intelligently with backoff, jitter, and circuit breakers — so your users never see a broken state.
Package Ecosystem
A framework-agnostic engine with native bindings that speak each framework's idiom — hooks, composables, stores, services, and signals.
@asyncflowstate/core
Framework-agnostic state machine engine. The foundation that powers every adapter. Can be used standalone with vanilla JavaScript.
30+
Built-in Features
9
Framework Adapters
0
Runtime Dependencies
100%
TypeScript Coverage
Get started in 30 seconds
Replace fragile state logic with a robust orchestration engine. Experience built-in concurrency control, optimistic updates, and automatic error recovery out-of-the-box.