Architecture
Describes commit 8363fa3Updated Made by anthropic/claude-haiku-5.5
Overview
A library for fetching, caching, synchronizing and updating server state in web apps.
What it does#
- Fetches and caches async data through queries and mutations.
- Keeps cached data fresh with refetching, invalidation and background updates.
- Provides framework bindings for React, Preact, Solid, Svelte, Vue, Angular and Lit.
- Persists the cache to storage and syncs it across browser tabs.
Main parts#
query-core: the framework-agnostic engine withQueryClient,QueryCacheand observers.- Framework adapters:
react-query,preact-query,solid-query,svelte-query,vue-query,angular-queryandlit-query. - Devtools packages: one devtools package per framework, built on
query-devtools. - Persistence packages:
query-persist-client-coreand the storage persisters built on it. eslint-plugin-queryandquery-codemodsfor linting and migration.
How the parts work together#
- Each adapter re-exports
query-coreand adds hooks or controllers on top. - Adapters create observers from
query-coreand subscribe them to framework state. - Persisters save and restore the
QueryClientstate throughquery-persist-client-core.
Where to start#
- Read
packages/query-core/src/index.tsfor the public core API. - Read
packages/react-query/src/index.tsto see how an adapter re-exports core. - Read
packages/query-persist-client-core/src/index.tsfor persistence.