Examples
Complete apps that use Effetch Query, on GitHub, and how to run them.
Getting started builds one page. The examples are whole apps, with sign-in,
server rendering and paged lists, that you can read, run and copy from.
They live in the repository's
examples/
folder and are typechecked with the package, so they match its API.
The apps
There are five examples:
effect-only.ts: queries, a stream query, cache reads and writes, and a mutation, from Effect code with no UI.basic/: the smallest React app, with dummyjson.com's todos and an optimistic toggle.tanstack-start/: a full TanStack Start app on Effetch endpoints: sign-in, a user's todos, a list with "Load more", a streamed detail page, and what that page shows for a todo that doesn't exist.tanstack-start-httpclient/: the same app on Effect'sHttpClient, without Effetch.react-router/: the same app in React Router's framework mode, on Effetch endpoints.
effect-only and the three full apps are also tested, in
test/examples/.
The examples README
walks through each one.
Run one
The examples run from the repository, and use the package from its source, so there's nothing to build first. You need Node 24 or later and pnpm.
-
Clone the repository and install its dependencies:
git clone https://github.com/monarcode/effetch-query.git cd effetch-query pnpm install -
Start the app you want, from the repository's root:
pnpm exec vite examples/basicpnpm exec vite dev examples/tanstack-startpnpm exec vite dev examples/tanstack-start-httpclientpnpm exec react-router dev examples/react-router -
Open the address the command prints. In the full apps, sign in as
emilys, with the passwordemilyspass.
The apps call dummyjson.com, which answers writes but saves nothing, so a reload shows its todos as they were.
effect-only has no UI. Its test runs the program and checks what each
step saw:
pnpm exec vitest run test/examples/effect-onlyWhat's next
- Frameworks: set up TanStack Start, Next.js or React Router the way the full apps do.
- Testing: test your own queries and components, as the examples' tests do.