Curved text logo saying 'Elysia JS'

Ergonomic Framework for Humans

TypeScript with  End-to-End Type Safety, type integrity, and exceptional developer experience. Supercharged by Bun.

Get Started
bun create elysia app
See why developers love Elysia  

The first production ready,
and most loved Bun framework

Designed 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)

  Just return

A string, number, or complex JSON

All we need to do is return.

  File support built-in

To send a file or image, just return.

Nothing more or less.

  Stream response

Use yield to stream a response.

All we need to do is return.

  Data in real-time

With µWebSocket built-in.

Send live data in just 3 lines.

Type Safety

import { Elysia, t } from 'elysia'

new Elysia()
	.patch('/profile', ({ body }) => body.profile, {




		body: t.Object({
			id: t.Number(),
			profile: t.File({ type: 'image' })
		})
	})
	.listen(3000)

Your own documentation

in 1 line

It's not magic...

With built-in integration with OpenAPI schema, Elysia can generate Swagger documentation for your API out of the box.

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

new Elysia()
	.use(swagger())
	.use(character)
	.use(auth)
	.listen(3000)
Scalar documentation generated by Elysia using Elysia Swagger plugin

Developer Experience

  For DevOps

OpenTelemetry

Elysia has 1st party support for OpenTelemetry. Instrumentation is built-in, so you can easily monitor your services on regardless of the platform.

11.88ms

POST /character/:id/chat

Request
Validation
Transaction
Upload
Sync
   For Frontend

End-to-end Type Safety

Like tRPC, Elysia provides type-safety from the backend to the frontend without code generation. The interaction between frontend and backend is type-checked at compile time.

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

const api = treaty<App>('api.elysiajs.com')

const { data } = await api.profile.patch({
    age: 21
})

Performance

21x

faster than Express

6x

faster than Fastify

  1. Elysia Bun
  2. 0 reqs/s
  3. Gin Go
  4. 0

  5. Spring Java
  6. 0

  7. Fastify Node
  8. 0

  9. Express Node
  10. 0

  11. Nest Node
  12. 0

Measured in requests/second. Result from TechEmpower Benchmark, Round 22 (2023-10-17) in PlainText

Community

Built with 💖 for