# Effetch Query > Server state for Effect apps, inspired by TanStack Query. Effetch Query loads data once, shares it between every component that shows it, keeps it fresh in the background, and updates it when you change something. A query is an Effect that runs with your app's services, its errors stay typed all the way to the component, and the cache is something your Effect programs can read and write. It works in React, React Native and code with no UI at all. Each link in the sections up to Optional is a page as Markdown, in the order the docs read. [llms-full.txt](https://effetch-query.pages.dev/llms-full.txt) has every page in one file. They cover the newest release of `@monarcode/effetch-query`. ## Get started - [Introduction](https://effetch-query.pages.dev/docs/index.md): Server state for Effect apps, inspired by TanStack Query. - [Installation](https://effetch-query.pages.dev/docs/installation.md): Add Effetch Query to a project, with Effetch, Effect and React. - [Getting started](https://effetch-query.pages.dev/docs/getting-started.md): Build a small todo app: an Effetch client, a query client, two queries, a component and a mutation. - [Coming from TanStack Query](https://effetch-query.pages.dev/docs/coming-from-tanstack-query.md): How TanStack Query's ideas and names map to Effetch Query. - [Examples](https://effetch-query.pages.dev/docs/examples.md): Complete apps that use Effetch Query, on GitHub, and how to run them. ## Queries - [Queries from endpoints](https://effetch-query.pages.dev/docs/queries.md): Turn Effetch endpoints into cached queries with fromClient. - [Queries from any Effect](https://effetch-query.pages.dev/docs/queries/without-effetch.md): Define queries with Query.make and Query.family, from any Effect you write. - [Query keys](https://effetch-query.pages.dev/docs/queries/keys.md): How a key finds a cached value, how an endpoint's key is built, and how a target picks the queries to act on. - [Freshness and refetching](https://effetch-query.pages.dev/docs/queries/freshness.md): When a value is fresh, when it's refetched, and when it's let go. - [Query errors](https://effetch-query.pages.dev/docs/queries/errors.md): What a failed query holds, how to turn a status into your own error, how to handle each one, and how to retry. - [Show a placeholder](https://effetch-query.pages.dev/docs/queries/placeholders.md): Show placeholder data while a query loads. - [Queries that read other queries](https://effetch-query.pages.dev/docs/queries/dependent.md): Build a query from the value of another query. - [Infinite queries](https://effetch-query.pages.dev/docs/queries/infinite.md): Page through a list, and load more pages on demand. - [Queries from a stream](https://effetch-query.pages.dev/docs/queries/streams.md): Make a query from a stream, such as a socket's messages. - [Push updates into a query](https://effetch-query.pages.dev/docs/queries/pushes.md): Update a fetched query's value from pushed events. - [Query options](https://effetch-query.pages.dev/docs/queries/options.md): Every option a query takes. ## React - [Read a query](https://effetch-query.pages.dev/docs/react.md): Show a query's result in a component with useQuery. - [Read a query as an object](https://effetch-query.pages.dev/docs/react/as-object.md): Read a query's data, error and loading flags as fields. - [Suspense and error boundaries](https://effetch-query.pages.dev/docs/react/suspense.md): Let Suspense show loading and error boundaries show failures. - [Refetch on demand](https://effetch-query.pages.dev/docs/react/refetch.md): Refetch a query from an event, such as a button or pull-to-refresh. - [Pause screens you can't see](https://effetch-query.pages.dev/docs/react/pause.md): Stop hidden screens from refetching. - [Atoms](https://effetch-query.pages.dev/docs/react/atoms.md): Use queries as effect/reactivity atoms. - [React Native](https://effetch-query.pages.dev/docs/react/react-native.md): Refetch when a React Native app returns to the foreground or comes back online. ## Mutations - [Define a mutation](https://effetch-query.pages.dev/docs/mutations.md): Define a mutation from an Effetch endpoint or an Effect. - [Run a mutation](https://effetch-query.pages.dev/docs/mutations/run.md): Run a mutation from a component or from Effect, and choose what happens when runs overlap. - [Invalidate after a mutation](https://effetch-query.pages.dev/docs/mutations/invalidate.md): Mark the queries a mutation changes as out of date. - [Optimistic updates](https://effetch-query.pages.dev/docs/mutations/optimistic.md): Write a change to the cache before the server confirms it, and undo it on failure. - [Show activity](https://effetch-query.pages.dev/docs/mutations/activity.md): Show a global indicator while queries or mutations run. - [Mutation options](https://effetch-query.pages.dev/docs/mutations/options.md): Every option a mutation takes. ## The cache - [Read and write the cache](https://effetch-query.pages.dev/docs/cache.md): Read, write and invalidate cached values from plain code and from Effect. - [Entities](https://effetch-query.pages.dev/docs/cache/entities.md): Write or read every cached copy of a record with one call. - [Keep copies in sync](https://effetch-query.pages.dev/docs/cache/entity-sync.md): Sync a record's cached copies whenever a query fetches it. - [Sign out and switch accounts](https://effetch-query.pages.dev/docs/cache/accounts.md): Clear one user's cached data on sign-out or an account switch. ## The client - [The query client](https://effetch-query.pages.dev/docs/client.md): Create the query client, give it your services, and dispose it when you're done. - [Defaults and app-wide hooks](https://effetch-query.pages.dev/docs/client/defaults.md): Set defaults and hooks for every query and mutation of a client. ## Server rendering - [Send the cache](https://effetch-query.pages.dev/docs/server-rendering.md): Fill the cache on the server, send it with the page, and load it in the browser. - [What's sent](https://effetch-query.pages.dev/docs/server-rendering/whats-sent.md): Which queries QueryClient.dehydrate sends to the browser, and what it leaves out. - [Stream the cache](https://effetch-query.pages.dev/docs/server-rendering/streaming.md): Send the page before every query has loaded, and stream each one as it finishes. ## Frameworks - [Frameworks](https://effetch-query.pages.dev/docs/frameworks.md): Use Effetch Query with TanStack Router and Start, Next.js or React Router, and the rules all three share. - [TanStack Router and Start](https://effetch-query.pages.dev/docs/frameworks/tanstack-start.md): Use Effetch Query in TanStack Router and TanStack Start. - [Next.js](https://effetch-query.pages.dev/docs/frameworks/nextjs.md): Use Effetch Query in the Next.js App Router. - [React Router](https://effetch-query.pages.dev/docs/frameworks/react-router.md): Use Effetch Query in React Router's framework mode. ## Testing - [Testing](https://effetch-query.pages.dev/docs/testing.md): Test queries, mutations and components with a fake backend and a fresh client. ## Reference - [Entry points](https://effetch-query.pages.dev/docs/reference.md): What each entry point exports, and the reference page that lists it. - [Limitations](https://effetch-query.pages.dev/docs/reference/limitations.md): What Effetch Query 0.1 doesn't do, so you can plan around it. - [@monarcode/effetch-query](https://effetch-query.pages.dev/docs/reference/core.md): The core entry point: its namespaces, and the two names it exports at the top level. - [Query](https://effetch-query.pages.dev/docs/reference/query.md): Every member of the Query namespace: defining queries, keys and targets, streams, and reading and writing the cache from Effect. - [InfiniteQuery](https://effetch-query.pages.dev/docs/reference/infinite-query.md): Every member of the InfiniteQuery namespace: queries that load a list one page at a time. - [Mutation](https://effetch-query.pages.dev/docs/reference/mutation.md): Every member of the Mutation namespace: defining and running mutations. - [Entity](https://effetch-query.pages.dev/docs/reference/entity.md): Every member of the Entity namespace: records whose cached copies a write updates everywhere. - [QueryClient](https://effetch-query.pages.dev/docs/reference/query-client.md): Every member of the QueryClient namespace: the client, its options and hooks, and sending the cache from a server. - [Signals](https://effetch-query.pages.dev/docs/reference/signals.md): Every member of the Signals namespace: where a client hears about focus and reconnects. - [@monarcode/effetch-query/react](https://effetch-query.pages.dev/docs/reference/react.md): Every export of the React entry point: the provider, the hooks and the boundaries. - [@monarcode/effetch-query/effetch](https://effetch-query.pages.dev/docs/reference/effetch.md): Every export of the Effetch entry point: queries and mutations from Effetch endpoints. - [@monarcode/effetch-query/react-native](https://effetch-query.pages.dev/docs/reference/react-native.md): Every export of the React Native entry point: focus and online signals from React Native's modules. - [@monarcode/effetch-query/react/tanstack-router](https://effetch-query.pages.dev/docs/reference/tanstack-router.md): Every export of the TanStack Router entry point: connecting a client to a router, and so to TanStack Start. ## Optional - [Changelog](https://raw.githubusercontent.com/monarcode/effetch-query/c063460e825a7ef68e295b4996cdd0581f494892/CHANGELOG.md): What changed in each release, and what to change in your code, as Markdown. - [Source on GitHub](https://github.com/monarcode/effetch-query): The package's source, its tests and runnable examples. - [Package on npm](https://www.npmjs.com/package/@monarcode/effetch-query): The published versions of `@monarcode/effetch-query`. - [Effetch](https://effetch.pages.dev/llms.txt): The typed HTTP client for Effect that Effetch Query pairs with, as its own llms.txt.