21x faster than Express
Supercharged by Bun runtime, Static Code Analysis, and Dynamic Code Injection
Being one of the top-performing TypeScript frameworks. Comparable to Go and Rust.
Elysia Bun
2,454,631 req/sSwoole PHP
1,035,418Gin Go
676,019Spring Java
506,087FastAPI PyPy
448,130Fastify Node
415,600Express Node
113,117Nest Node
105,064
Measure in requests/second. Result from official TechEmpower Benchmark Round 22 (2023-10-17) in PlainText.
Made for Humans
Focus on productivity ++
If you found yourself writing code for the framework, then there's something wrong with the framework.
That's why Elysia invests time to experiment with design decisions to craft the most ergonomic way possible for everyone
From built-in strict-type validation to a unified type system, and documentation generation, making an ideal framework for building servers with 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
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
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
// server.ts
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
// client.ts
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'})
if(error)
switch(error.status) {
case 400:
throw error.value
case 418:
throw error.value
}
data
It works with that
Being one of the most popular choices for a Bun web framework, likely there is a plugin for what you want.
If the plugin you need is not there, it's easy to create one and share it with the community.
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.
Made possible by you
Elysia is not backed by any organization
Made possible by the support of the community and you
San Francisco Compute Company
for a month
Scalar
for 8 months
Jarred Sumner
for a year
_typedev
for a year
DOM CHAROENYOS
for 8 months
mabujaber
for 6 months
Naoki Takahashi
for 5 months
Christian Rishøj
for 10 months
henrycunh
for 8 months
Khyber Sen
for 8 months
MeCode
for 8 months
yoyismee
for 8 months
Nemanja
for 7 months
CellaJS
for 6 months
kubilay
for 5 months
Inertia
for 4 months
Kevin Porten
for 4 months
RiestelX
for 3 months
Sunghyun Cho
for 2 months
Vectorized
for 2 months
Sven Graziani
for 9 days
Huly® Platform™
for 8 days
Vallaris Maps Platforms
for a day
Thanatat Tamtan
for 2 years
xHomu
for a year
Marco Beier
for 8 months
Ronald Dijks
for 5 months
Tommy D. Rossi
for a month
gabriel-peracio
for 15 days
hsnmkls
for a year
Patrick Wozniak
for a year
Jittat Fakcharoenphol
for a year
[object Object]
for a year
Ajit Krishna
for a year
Louis Gentil
for a year
David L. Bowman
for 8 months
Ciro Spaciari
for 8 months
Kamil Jakubus
for 7 months
✦ freddie
for 6 months
Kira Kitsune
for 6 months
Ricardo Devis Agullo
for 6 months
Foxie Solutions
for 6 months
4ndrs
for 5 months
drsmile1001
for 4 months
Merlinz-dev
for 24 days
0xYok
for 24 days
Jason Dubaniewicz
for 4 days
Nutthapat Pongtanyavichai
for 2 years
Manassarn "Noom" Manoonchai
for 2 years
Phawit Pornwattanakul
for 2 years
Vorrapong Kertnat
for a year
First Sutham
for a year
stanley
for 8 months
Dominik Seger
for 7 months
Kaze
for 7 months
Marcello
for 6 months
Hassadee Pimsuwan
for 6 months
Nayuki
for 6 months
Altin Thaci
for 5 months
白田 連大
for 5 months
Idar Lafish
for 4 months
Kyle
for 4 months
suchai-foundnerds
for 4 months
Chanon MEe-Iam
for 3 months
Surachet Sangasaeng
for 3 months
Nathan Chapman
for 3 months
Nikita
for 3 months
Yuzuki Aida
for 2 months
Dawid Danieluk
for 2 months
Freek
for a month
TAKZOBYE
for a month
S. Srisuk
for a month
l2D
for 24 days
Nopdanai Dejvorakul (孙贤德)
for 19 days
Alan Reis
for 17 days
Piti Pitiaunchamroen
for 17 days
Sergen Tanguc
for 14 minutes
And you
Become sponsor
Start in minutes
Scaffold your project, and run server in no time
bun create elysia app