Skip to content

ElysiaJS

Ergonomic Framework for Humans

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

Get Started bun create elysia app

See why developers love Elysia

Elysia is fast

18x faster than Express

Supercharged by Bun runtime, Static Code Analysis, and various micro optimization.

Elysia is able to outperform in various situations, being one of the top-performing TypeScript frameworks.

  1. Elysia Bun

    276,322
  2. Hono Bun

    254,376
  3. Baojs Bun

    173,587
  4. Fast Deno

    85,924
  5. Fastify Node

    58,742
  6. Koa Node

    37,198
  7. Express Node

    15,133
  8. Nest Node

    13,510

Measure in requests/second. Benchmark for parsing query, path parameter and set response header on Debian 11, Intel i7-13700K tested on Bun 0.7.2 at 6 Aug 2023. See the benchmark condition here

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'
    }))
    .listen(3000)

Just return

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',
        ({ body }) => body,
        {
            body: t.Object({
                username: t.String()
            })
        }
    )
    .listen(3000)

Type Strict

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 Compliance

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.

Introducing

End–to-End Type Safety

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

See how it works
// server.ts
import { Elysia, t } from 'elysia'

const app = new Elysia()
    .patch(
        '/user/age',
        ({ body }) => signIn(body), 
        {
            body: t.Object({
                name: t.String(),
                age: t.Number()
            })
        }
    )
    .listen(80)
    
export type App = typeof app
// client.ts
import { edenTreaty } from '@elysiajs/eden'
import type { App } from 'server'
    
const eden = edenTreaty<App>('http://localhost')

await eden.user.age.patch({
    name: 'saltyaom',
    age: '21'
})

Type 'string' is not assignable to type 'number'

Try it out

Being WinterCG compliant, Elysia can run in your browser!
Edit the code and see live update immediately.

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 💖 by