Elysia is an ergonomic web framework for building backend servers with Bun. It is designed with simplicity and type safety in mind, offering a familiar API with extensive TypeScript support and strong performance characteristics.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/elysiajs/documentation/llms.txt
Use this file to discover all available pages before exploring further.
Performance
Building on Bun and extensive compile-time optimization, Elysia generates optimized code on the fly using static code analysis. It outperforms most web frameworks available today and matches the performance of Golang and Rust frameworks in independent benchmarks.| Framework | Runtime | Average | Plain text | Dynamic params | JSON body |
|---|---|---|---|---|---|
| elysia | bun | 255,574 | 313,073 | 241,891 | 211,758 |
| hono | bun | 203,937 | 239,229 | 201,663 | 170,920 |
| h3 | node | 96,515 | 114,971 | 87,935 | 86,637 |
| fastify | node | 60,322 | 71,150 | 62,060 | 47,756 |
| express | node | 15,913 | 17,736 | 17,128 | 12,873 |
TypeScript
Elysia is designed to help you write less TypeScript. Its type system infers types from your code automatically, providing type safety at both runtime and compile time without requiring explicit annotations.id is typed automatically — both at compile time and at runtime. The value replacing :id in a request is available as params.id with no manual type declaration needed.
Elysia’s goal is to let you focus on business logic. TypeScript is recommended but not required.
Type integrity
To go further, Elysia providesElysia.t, a schema builder backed by TypeBox that validates types at both runtime and compile time, creating a single source of truth for your data.
The following example restricts the id parameter to numbers only:
Elysia.t schema serves four purposes simultaneously:
- Runtime validation and coercion
- TypeScript type inference
- OpenAPI schema generation
- Error responses on validation failure
Standard Schema
Elysia supports Standard Schema, so you can use your preferred validation library alongside or instead ofElysia.t:
- Zod
- Valibot
- ArkType
- Effect Schema
- Yup, Joi, and more
OpenAPI
Elysia adopts OpenAPI as a default standard. Because all schema metadata is already available at the framework level, generating API documentation requires a single plugin call:OpenAPI from types
Elysia also supports generating OpenAPI schemas directly from TypeScript types with one line — a capability similar to FastAPI’s automatic schema generation, but for TypeScript:End-to-end type safety
With Elysia, type safety is not limited to the server. The Eden client library synchronizes your server types with your frontend automatically, similar to tRPC, but over standard HTTP and without code generation. Export your app type on the server:Type soundness
Most end-to-end type-safe frameworks only model the happy path, leaving error handling outside the type system. Elysia infers all possible outcomes from lifecycle events and macros across your codebase, including error statuses returned from plugins:error type from Eden reflects every possible status code the route can return — including those added by plugins — without any manual annotation.
Platform agnostic
Elysia is optimized for Bun but not limited to it. Being WinterTC compliant means Elysia servers run on:- Bun
- Node.js
- Deno
- Cloudflare Workers
- Vercel
- Expo API routes
- Next.js API routes
- Astro API routes
- SvelteKit, Nuxt, Tanstack Start, and more
See the integrations section in the sidebar for setup guides for each platform.