// server.tsimport{ Elysia }from'elysia'const app =newElysia().post('/auth/sign-in', signIn, signModel).listen(8080)exporttypeApp=typeof app
// client.tsimport{ eden }from'@elysiajs/eden'importtype{ App }from'server'const api =eden<App>('http://0.0.0.0:8080')// Fully type-safe both client/server like tRPCawait api.auth.signIn.post(data)
newElysia().get('/',()=>'hello world').post('/',({ body, set })=>{
set.status =418return body
}).get('/awesome-music',({ set })=>{
set.redirect ='https://youtu.be/dQw4w9WgXcQ'})
Familiar syntax that clicks
Picking up from Node.js, Elysia is easy to get started with as it has familar syntax like most of the framework.
Also with great support of TypeScript, you will have the best experience with inferred types and autocomplete.
Measure in requests/second. Benchmark for parsing query, path parameter and set response header on Debian 11, Intel i7-13700K tested on Bun 0.5.7 at 8 Mar 2023.
Fast by default
Powered by Bun means faster than Node.js by default.
Optimized for Bun and JavaScript Core. Curated from selective benchmark from various real-world situations.
With Eden, you get fully type-safe client on both client and server
import{ Elysia, t }from'elysia'const app =newElysia().put('/shelf/plushie',({ db, body })=>{return db.put(body)},{
schema:{
body: t.Object({
name: t.String(),
quantity: t.Number()})}}).listen(80)exporttypeApp=typeof app
Type 'string' is not assignable to type 'number'
import{ eden }from'@elysiajs/eden'importtype{ App }from'./server'const api =eden<App>('http://localhost')await api.shelf.plushie.put({
name:'Blåhaj',
quantity:'200'})
Connect frontend and backend like tRPC
It's easy to get started
Whether you're new or expert, you will find yourself running server up in no time.