Eden is Elysia’s built-in RPC-like client that synchronizes types between your server and client using only TypeScript’s type inference. When you change a route, response type, or validation schema on the server, those changes are instantly reflected on the client with full auto-completion and compile-time error checking — without any build step or generated files.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/elysiajs/documentation/llms.txt
Use this file to discover all available pages before exploring further.
How it works
Export thetypeof your Elysia app from the server, import it as a type-only import on the client, and pass it as a generic to the Eden client factory. TypeScript does the rest.
Two client styles
Eden ships two modules. Choose based on your preference:Eden Treaty
Proxy-based client where API paths become method chains:
app.user({ id }).get(). Recommended for most projects. Supports WebSocket.Eden Fetch
Fetch-style client where you pass a path string and options object. Familiar to anyone who has used the Fetch API directly.
Eden Treaty (recommended)
Eden Treaty maps your server’s route tree to a JavaScript object. HTTP paths become dot-notation property chains, and dynamic segments become function calls.Eden Fetch
Eden Fetch keeps the familiarfetch('/path', options) pattern while still providing full type inference on both the request and response.
Eden Fetch does not support WebSocket. If you need real-time communication, use Eden Treaty. Install Eden Fetch the same way as Treaty — see the installation guide.
When to use each
| Situation | Recommendation |
|---|---|
| New project | Eden Treaty |
| Prefer fetch-style API | Eden Fetch |
| Need WebSocket | Eden Treaty |
| More than 500 routes in a single frontend | Eden Fetch (better TS performance at scale) |
Next steps
Installation
Install
@elysia/eden, export your app type, and make your first type-safe call.Treaty overview
Learn the proxy syntax, dynamic path parameters, and supported HTTP methods.
Treaty parameters
Pass body, query params, headers, and files with compile-time validation.
Testing
Write unit tests against your Elysia app with no running server needed.