Skip to content

πŸ™ type-safe Elysia.js client with powerful asynchronous state management.

License

Notifications You must be signed in to change notification settings

ap0nia/eden-query

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

eden-query

elysia.js-eden + tanstack-query integrations

GitHub Release Workflow GitHub Repo stars GitHub last commit

NPM Version NPM License NPM Downloads

codecov

πŸ“‹ Overview

eden-query allows you to connect to your elysia backend with end-to-end type-safety and powerful asynchronous state management from your frontend.

Features

  • 🌎 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.

πŸš€ Get Started

Installation

# npm
npm install elysia @ap0nia/eden-react-query

# yarn
yarn add elysia @ap0nia/eden-react-query

# pnpm
pnpm add elysia @ap0nia/eden-react-query

Usage (React)

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

Framework Integrations

More documentation for framework-specific packages can be found in their respective project directories as well as the documentation.

General Purpose Integrations

A custom implementation of the eden client is maintained here with the same core functionality as the officially documented one.

πŸ“– Learn More

To see more advanced examples and usage of the integration, read the full documentation.

Core Technologies

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.

πŸ‘· Contributing

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.

⭐Star History

Star History Chart