The 5-Layer Resilience Stack
Flux turns the browser into a resilient data layer using five cooperating layers — a local cache, an offline write queue, a cross-tab-safe replay engine, a realtime sync layer, and a single intake gate that keeps all of it consistent. This page explains what each layer does and why there are five of them instead of one big cache.
A cache alone answers one question: "do I have this data already?" It has nothing to say about what happens when the user is offline and tries to change that data, when two browser tabs are open at once, when the network comes back after ten minutes away, or when a live update arrives at the exact moment a page is loading from disk. Each of those is a different failure mode, and bolting all of them onto a single cache layer is how caching libraries turn into unmaintainable piles of edge-case flags.
Flux instead gives each failure mode its own layer, with a narrow job and a clear boundary to the layer next to it. You never have to think about which layer is doing what day to day — register() activates the right ones for you — but understanding the five makes Flux's behavior predictable instead of magic.
Layer 1 — Local Cache
Layer 2 — Offline Write Queue
Layer 3 — Coordinated Replay
core-concepts/conflict-resolution for the full model.Layer 4 — Realtime Sync
core-concepts/sync-anchors and core-concepts/activity-bus for how that catch-up is coordinated against your regular cache-freshness checks so the two never fire redundant requests against each other.Layer 5 — The Unified Intake Gate
Every layer is optional in the sense that a channel only pays for what it uses — a read-only public dataset only exercises Layers 1, 4, and 5. A channel with a queueConfig also gets Layers 2 and 3. You never choose layers directly; they activate based on what you configure on register().
Each layer is documented in more depth on its own page — see core-concepts/idb-ttl (Layer 1), core-concepts/offline-queue (Layer 2), core-concepts/conflict-resolution (Layer 3), core-concepts/sync-anchors and core-concepts/activity-bus (Layer 4), and core-concepts/multi-tenant-scoping, which cuts across all five layers to keep per-user data isolated and cleanly purged on logout.