Elysia - Ergonomic Framework for Humans
Elysia is an ergonomic framework for Humans.
With end‑to‑end type safety and great developer experience.
Elysia is familiar, fast, and has first‑class TypeScript support with well‑thought integration between services whether it’s tRPC, Swagger or WebSocket.
Hero
bun create elysia app
Get Started → /at-glance
See why developers love Elysia
The first production ready, and most loved Bun framework
Trusted by team at
- X / Twitter – using Elysia for Jetfuel
- CS Money – high RPS
- Tiptap – moved from Hono Node to Elysia Bun
- Bank for Agriculture and Agricultural Cooperatives Thailand – internal website
- Abacatepay – stripe alternative
- ConnexTickets – performance improvement
- Decidable – Business Intelligence platform
Made for Humans
Design for Humans
Our goal is to design an ergonomic, sensible, and productive framework that even beginners can use easily.
Designed to avoid unnecessary complexity and type complexity for you to focus on building.
A framework that feels just like JavaScript.
import { Elysia, file } from 'elysia'
new Elysia()
.get('/', 'Hello World')
.get('/image', file('mika.webp'))
.get('/stream', function* () {
yield 'Hello'
yield 'World'
})
.ws('/realtime', {
message(ws, message) {
ws.send('got:' + message)
}
})
.listen(3000)
Summary
| Feature | What you return | Example |
|---|---|---|
| Just return | A string, number, or complex JSON | return { message: 'hello' } |
| File support | file('path') | file('image.png') |
| Stream response | yield a value | function* () { yield 'Hello'; yield 'World'; } |
| Data in real‑time | WebSocket | ws('/realtime', { message(ws, msg) { ws.send('got:' + msg); } }) |
Benchmark
| Framework | Req/s |
|---|---|
| Elysia (Bun) | 2,454,631 |
| Gin (Go) | 676,019 |
| Spring (Java) | 506,087 |
| Fastify (Node) | 415,600 |
| Express (Node) | 113,117 |
| Nest (Node) | 105,064 |
Measured in requests/second. Result from https://www.techempower.com/benchmarks/#hw=ph&test=plaintext§ion=data-r22 Round 22 (2023‑10‑17).
Your code, your runtime
- Elysia is optimized for Bun but not vendor‑lock‑in.
- Built on Web‑Standard – run Elysia anywhere.
Type Safety
Best in Class – Type Safety
import { Elysia, t } from 'elysia'
new Elysia()
.post('/user', ({ body }) => {
return body, {
body: t.Object({
name: t.Literal('SaltyAom'),
age: t.Number(),
friends: t.Array(t.String())
})
}
})
Bring your own Validator
Elysia offers a built‑in validator, but you can also bring your favorite validator, like Zod, Valibot, ArkType, Effect, and more.
Code examples
TypeBox
import { Elysia, t } from 'elysia'
new Elysia()
.post('/user', ({ body }) => {
return body, {
body: t.Object({
name: t.Literal('SaltyAom'),
age: t.Number(),
friends: t.Array(t.String())
})
}
})
Zod
import { Elysia } from 'elysia'
import { z } from 'zod'
new Elysia()
.post('/user', ({ body }) => {
return body, {
body: z.object({
name: z.literal('SaltyAom'),
age: z.number(),
friends: z.array(z.string())
})
}
})
Valibot
import { Elysia } from 'elysia'
import { validator } from '@valibot/valibot'
new Elysia()
.post('/user', ({ body }) => {
return body, {
body: validator({
name: validator.string().equals('SaltyAom'),
age: validator.number(),
friends: validator.array(validator.string())
})
}
})
ArkType
import { Elysia } from 'elysia'
import { z } from 'arktype'
new Elysia()
.post('/user', ({ body }) => {
return body, {
body: z({
name: 'SaltyAom',
age: z.number(),
friends: z.string().array()
})
}
})
Effect
import { Elysia } from 'elysia'
import { t } from '@effect/schema/Schema'
new Elysia()
.post('/user', ({ body }) => {
return body, {
body: t.struct({
name: t.literal('SaltyAom'),
age: t.number,
friends: t.array(t.string)
})
}
})
Other Sections (placeholders for the rest of the page)
- Further documentation, tutorials, API reference, and advanced features would follow in the same format, with headings, paragraphs, code blocks, and interactive snippets converted into Markdown.