Skip to content
Curved text logo that displays 'Elysia.js'

Ergonomic Framework for Humans

TypeScript with End-to-End Type Safety, unified type system and outstanding developer experience. Supercharged by Bun.

Get Started
bun create elysia app

See why developers love Elysia

21x faster than Express

Supercharged by the Bun runtime and built-in optimizations such as Static Code Analysis, and Dynamic Code Injection.

Elysia.js one of the most performant TypeScript frameworks, even comparable to solutions written in Go and Rust.

  1. ElysiaBun

    2,454,631 req/s
  2. Swoole PHP

    1,035,418
  3. Gin Go

    676,019
  4. Spring Java

    506,087
  5. FastAPI PyPy

    448,130
  6. Fastify Node

    415,600
  7. Express Node

    113,117
  8. Nest Node

    105,064
Measured in requests/second. Results from official TechEmpower Benchmark, Round 22 (2023-10-17) in PlainText.

Made for Humans

Productivity ++

If you have ever spent more time writing code for the framework instead of your application, then there's something wrong with the framework.

Elysia prioritizes developer experience by experimenting with design decisions to craft the best ergonomics.

Built-in features such as strict type validation, robust type system, and automatic documentation generation, make Elysia an ideal framework for building servers with TypeScript.

typescript
import { Elysia } from 'elysia'

new Elysia()
  .get('/', 'Hello World')
  .get('/json', () => ({ hello: 'world' }))
  .get('/id/:id', ({ params: { id } }) => id)
  .listen(3000)

Just Value

No need for an additional method, just return the value to send data back to the client.

Whether it's a regular string, or complex JSON, just return the value and Elysia will handle the rest

typescript
import { 
Elysia
,
t
} from 'elysia'
new
Elysia
()
.
post
(
'/profile', // โ†“ hover me โ†“ ({
body
}) =>
body
,
{
body
:
t
.
Object
({
username
:
t
.
String
(),
}), }, ) .
listen
(3000)

Type Safety

Powered by TypeBox, Elysia enforces type-strict validation to ensure type integrity by default

Elysia infers types to TypeScript automatically to create unified type system like statically typed language

typescript
import { Elysia, t } from 'elysia'
import { swagger } from '@elysiajs/swagger'
import { users, feed } from './controllers'

new Elysia()
  .use(swagger())
  .use(users)
  .use(feed)
  .listen(3000)

OpenAPI / Swagger

Elysia generates OpenAPI 3.0 specs automatically to integrate with various tools across multiple languages

Thanks to OpenAPI compliance, Elysia can generate Swagger in one line with the Swagger plugin.

Endโ€“to-End Type Safety

Synchronize types across all applications.
Move fast and break nothing like tRPC.

Hover code below to see type definition

typescript
import { 
Elysia
,
t
} from 'elysia'
const
app
= new
Elysia
()
.
patch
(
'/user/profile', ({
body
,
error
}) => {
if (
body
.
age
< 18) return
error
(400, 'Oh no')
if (
body
.
name
=== 'Nagisa') return
error
(418)
return
body
}, {
body
:
t
.
Object
({
name
:
t
.
String
(),
age
:
t
.
Number
(),
}), }, ) .
listen
(80)
export type
App
= typeof
app
typescript
import { 
treaty
} from '@elysiajs/eden'
import type {
App
} from './server'
const
api
=
treaty
<
App
>('localhost')
const {
data
,
error
} = await
api
.
user
.
profile
.
patch
({
name
: 'saltyaom',
age: '21',
Type 'string' is not assignable to type 'number'.
}) if (
error
)
switch (
error
.
status
) {
case 400: throw
error
.
value
case 418: throw
error
.
value
}
data

Can't find what you're looking for?

Join the community

Elysia is one of the biggest communities for Bun first web frameworks.

You can ask your questions / propose a new feature / file a bug with our community and mainters.


Elysia Feature Sheet

Start in minutes

Scaffold your project, and run server in no time

bun create elysia app

Built with ๐Ÿ’– dear