Skip to main content
Elysia Hero

What is Elysia?

Elysia is a fast and friendly TypeScript web framework built on top of Bun. It’s designed with developer experience in mind, offering end-to-end type safety, exceptional performance, and an ergonomic API that makes building web applications a joy.
import { Elysia } from 'elysia'

const app = new Elysia()
  .get('/', () => 'Hello Elysia')
  .get('/json', () => ({ message: 'Hello World' }))
  .listen(3000)

console.log(`🦊 Elysia is running at http://localhost:3000`)

Why Elysia?

Blazing fast

Built on Bun, Elysia delivers exceptional performance - up to 18x faster than Express based on TechEmpower benchmarks.

End-to-end type safety

Full TypeScript support with automatic type inference across your entire application, from request to response.

Developer experience

Ergonomic API designed for humans. Write less code and get more done with intuitive patterns and helpful error messages.

WinterCG compliant

Follows web standards and supports multiple runtime adapters including Bun, Cloudflare Workers, and web standard environments.

Rich ecosystem

Growing ecosystem of official and community plugins for validation, authentication, OpenAPI, WebSockets, and more.

Built-in validation

Powerful schema validation with TypeBox integration. Validate requests and responses with full type inference.

Key features

Type safety without the hassle

Elysia provides end-to-end type safety with zero additional effort. Types flow automatically from your schema definitions through your handlers:
import { Elysia, t } from 'elysia'

new Elysia()
  .post('/user', ({ body }) => {
    // body is fully typed as { name: string, age: number }
    return `Created user ${body.name}, age ${body.age}`
  }, {
    body: t.Object({
      name: t.String(),
      age: t.Number()
    })
  })
  .listen(3000)

Plugin system

Extend Elysia with reusable plugins that can add routes, state, decorators, and lifecycle hooks:
const plugin = new Elysia()
  .decorate('getDate', () => new Date())
  .get('/plugin-route', () => 'From plugin')

const app = new Elysia()
  .use(plugin)
  .get('/', ({ getDate }) => getDate())
  .listen(3000)

Guards and lifecycle hooks

Apply validation and transformations to groups of routes with guards:
import { Elysia, t } from 'elysia'

new Elysia()
  .guard(
    {
      query: t.Object({
        name: t.String()
      })
    },
    (app) => app
      .get('/profile', ({ query }) => `Hello ${query.name}`)
      .get('/settings', ({ query }) => `Settings for ${query.name}`)
  )
  .listen(3000)

State management and derivation

Manage application state and derive values with full type safety:
import { Elysia } from 'elysia'

new Elysia()
  .state('counter', 0)
  .derive(({ store }) => ({
    increase() {
      store.counter++
    }
  }))
  .get('/', ({ increase, store }) => {
    increase()
    return { counter: store.counter }
  })
  .listen(3000)

Performance that matters

Elysia is designed for speed. Built on Bun’s blazing-fast runtime, Elysia delivers exceptional performance without sacrificing developer experience:
  • 18x faster than Express based on TechEmpower benchmarks
  • Zero-cost abstractions - ergonomic APIs that compile to optimal code
  • Minimal overhead - lean core with optional features as plugins

Get started

Installation

Install Elysia and set up your development environment.

Quick start

Build your first Elysia application in minutes.

Core concepts

Learn the fundamental concepts behind Elysia.

Examples

Explore real-world examples from the repository.

Community

Join the Elysia community to get help, share your projects, and contribute:

Build docs developers (and LLMs) love