Skip to content

Latest commit

 

History

History
34 lines (24 loc) · 1.26 KB

File metadata and controls

34 lines (24 loc) · 1.26 KB

ADR-007: Frontend state management: TanStack Query vs Redux vs Zustand

Status: Accepted Date: 2026-03-24

Context

The LearnVault frontend needs to handle complex asynchronous states (fetching Stellar account balances, course progress, and weather data) alongside simple global UI states (theme, user session). We evaluated Redux, Zustand, and TanStack Query.

Decision

We have selected TanStack Query for server-state (API/Blockchain data) and Zustand for the remaining lightweight global client-state.

Consequences

Positive

  • Automatic Caching: TanStack Query handles the "stale-while-revalidate" logic for blockchain data out of the box, reducing unnecessary RPC calls to Soroban nodes.
  • Boilerplate Reduction: Zustand provides a much cleaner, hook-based API compared to Redux, which is critical for maintaining our Next.js frontend.
  • Developer Experience: Clear separation between "data from the server" and "local UI state" makes the codebase easier to navigate for new contributors.

Negative

  • Learning Curve: New contributors must understand two different state paradigms (Query vs Store).
  • Bundle Size: Adding two libraries instead of one, though both are significantly smaller than the Redux ecosystem.