Eden-Query is a type-safe, API client for Elysia.js that provides asynchronous state management with Tanstack Query.
The Eden-Query project is a collection of libraries that includes the RPC client, @ap0nia/eden,
and framework-specific integrations, such as @ap0nia/eden-react-query and
@ap0nia/eden-svelte-query for React and Svelte respectively.
The @ap0nia/eden library is a distinct, but functionally identical implementation of the
official @elysiajs/eden library.
Eden-Query is most valuable to frontend projects that connect to an Elysia.js backend. The Elysia.js types may be exposed from a separate project within a monorepo, or within a single project that leverages a full-stack solution such as Next.js or SvelteKit.
See the examples directory for examples.
Batching
Batching by the client and server
Transformers
Transformers to extend JSON data
Links
Links to control the request flow
Eden-Query offers two implementations, fetch and treaty, just like the official eden library.
This has not been implemented for any framework yet...
/api/a/b -> eden.api.a.b.eden.api.a.b.get.createQuery -> createQuery for GET request to /api/a/b.A React client application cna use the hooks from Eden-Query to manage asynchronous state from the Elysia server application.
useMutation does not actually perform the request.
The result of useMutation has mutate and mutateAsync methods that receive the input to make the request.
This library supports the same type of links that tRPC has.
The official eden library only resolves requests, so Eden-Query provides helper methods to quickly initialize a client that does the same.
Read more about Eden-Query links here.
This creates a basic eden client that resolves requests in the same way as the official eden implementation.
Using this helper method means you don't have to initialize an httpLink from scratch,
and you can provide HTTPLinkOptionsdirectly to the method to create the client.
Creates a client that can combine multiple requests into a single batch request.
In order for this client to work properly, the Elysia server application must use the batchPlugin
or edenPlugin with the batchproperty defined.
Elysia.js application with batching enabled
React-Query Batch Client
This library supports the same transformer API as tRPC.
The transformers will only modify request.body.
So this will NOTaffect GET, OPTIONS, or HEAD requests; only POST, PUT, PATCH, etc.
Read more about this Eden-Query transformers here.
tRPC is a type-safe, full-stack integration that allows developers to easily types between their frontend and backend without code generation.
The core architecture and public API of Eden-Query was inspired by tRPC, making transitions between the two libraries feel seamless.
Some documentation may link to this project to provide additional information and context.