Skip to content
new Elysia()
  .get('/', () => 'hello world')
  .post('/', ({ body, set }) => {
    set.status = 418

    return 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.

See (Cheat Sheet) for yourself

First-class TypeScript

Instead of writing types, Elysia understands what you want and automatically infers the types from your code.

Type 'number' is not assignable to type
'{ id: number; name: string; }'

import { Elysia, t } from 'elysia'

const nendoroidSchema = t.Object({
  id: t.Number(),
  name: t.String()
})

new Elysia()
  .put('/nendoroid', async ({ body, database }) => {
    return body.id
  }, {
    body: nendoroidSchema,
    response: nendoroidSchema
  })

With Elysia, you don't need to understand much of TypeScript to take advantage of TypeScript.

import { Elysia, t } from 'elysia'
import { swagger } from '@elysiajs/swagger'

new Elysia()
  .use(swagger())

Documentation in one line

Elysia can generate API Documentation in just 1 line with Swagger plugins.

No more meeting to explain the routes map of your APIs.

Swagger Plugins

Elysia

265,986

Hono

240,167

Fastify Node

58,664

Koa Node

38,177

Express Node

15,149

Nest Node

13,565

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.

View Benchmark

End-to-end Type Safety

With Eden, you get fully type-safe client on both client and server

import { Elysia, t } from 'elysia'

const app = new Elysia()
  .put('/shelf/plushie', 
    ({ db, body }) => {
      return db.put(body)
    }, {
    body: t.Object({
      name: t.String(),
      quantity: t.Number()
    })
  })
  .listen(80)
  
export type App = typeof app

Type 'string' is not assignable to type 'number'

import { edenTreaty } from '@elysiajs/eden'
import type { App } from './server'

const api = edenTreaty<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.

ps. you can get your first server up and running in 5 minute

Build with 💖 dear