elysia.js-eden + tanstack-query integrations
eden-query
allows you to connect to your elysia
backend with end-to-end type-safety and powerful
asynchronous state management from your frontend.
- 🌎 Framework agnostic.
- 🦺 Full end-to-end type-safety.
- ✅ Fully supports REST API standards.
- 🖥️SSR support and examples.
- ✨ Reactive and infinite queries.
- ⚡ Batching requests on both the client and server.
- 🔗 Links for customizing the flow of data.
- 👀 Data transformers for enhanced JSON handling.
# npm
npm install elysia @ap0nia/eden-react-query
# yarn
yarn add elysia @ap0nia/eden-react-query
# pnpm
pnpm add elysia @ap0nia/eden-react-query
import { eden } from './eden'
export function Products() {
const { data } = eden.api.products.get.useQuery()
return (
<ul>
{data?.map((product) => (
<li id={product.id}>{product.name}</li>
)}
</ul>
)
}
eden.ts
import type { App } from './server'
import { createEdenTreatyReactQuery } from '@ap0nia/eden-react-query'
export const eden = createEdenTreatyReactQuery<App>()
server.ts
import { Elysia } from 'elysia'
const app = new Elysia().get('/api/products', () => {
return [
{
id: 0,
name: 'Product 0',
},
{
id: 1,
name: 'Product 1',
},
{
id: 2,
name: 'Product 2',
},
]
})
export type App = typeof app
More documentation for framework-specific packages can be found in their respective project directories as well as the documentation.
A custom implementation of the eden
client is maintained here with the same core functionality
as the officially documented one.
To see more advanced examples and usage of the integration, read the full documentation.
eden-query
is a combination of three technologies:
Elysia.js
TypeScript server framework supercharged by Bun with End-to-End Type Safety, unified type system, and outstanding developer experience. Learn more about it from the official documentation.
Eden
A type-safeREST client that offers end-to-end typesafety. Learn more about it from the official documentation.
Tanstack-Query
A full featured asynchronous state management solution. Learn more about it from the offical documentation.
Please read the contributing guidelines before opening an issue or pull request to begin developing. The guide will provide an overview of steps to initialize the local development environment, as well as architecture of the project.