Elysia.js
js is a high-performance, TypeScript-first web framework built specifically for the Bun runtime, emphasizing end-to-end type safety, ergonomic developer experience, and speed by leveraging Bun's fast HTTP server internals.
Definition
Elysia.js is a high-performance, TypeScript-first web framework built specifically for the Bun runtime, emphasizing end-to-end type safety, ergonomic developer experience, and speed by leveraging Bun's fast HTTP server internals.
Overview
Elysia.js was created to take full advantage of the Bun JavaScript runtime's performance characteristics while offering a developer experience centered on TypeScript type inference: rather than requiring developers to manually write and maintain separate type definitions for routes, request bodies, and responses, Elysia infers types automatically from how routes are defined, and its companion tool Eden lets a frontend client consume a backend Elysia API with fully type-safe requests and responses, similar in spirit to tRPC but built around standard HTTP/REST conventions rather than a custom RPC protocol. The framework's API design draws inspiration from Express and Fastify's chainable route-definition style but adds first-class schema validation (via a built-in TypeBox-based validator) for request bodies, query parameters, and headers, catching invalid requests automatically and generating matching TypeScript types from the same schema definitions — a single source of truth for both runtime validation and compile-time types. Elysia also ships with a plugin ecosystem covering common needs like Swagger/OpenAPI documentation generation, JWT authentication, CORS, static file serving, and WebSocket support, and its plugin system is designed to preserve full type inference across plugin boundaries, which is a common pain point in other TypeScript web frameworks. Benchmarks published by the Elysia team and independent comparisons have repeatedly shown it among the fastest JavaScript/TypeScript web frameworks, largely a result of being built specifically atop Bun's native HTTP server rather than a Node.js-compatible abstraction layer. This tight coupling to Bun is also its main limitation: while some compatibility with Node.js exists, Elysia is designed and optimized primarily for Bun, so teams committed to a purely Node.js deployment environment typically look to alternatives like Hono, Fastify, or Express instead.
Key Features
- TypeScript-first framework with automatic end-to-end type inference
- Built specifically for and optimized around the Bun runtime
- Eden client library enables fully type-safe frontend-to-backend API calls
- Built-in TypeBox-based schema validation for bodies, queries, and headers
- Single schema definition drives both runtime validation and TypeScript types
- Plugin ecosystem: Swagger/OpenAPI docs, JWT auth, CORS, WebSockets
- Consistently benchmarks among the fastest JS/TS web frameworks
- Express/Fastify-inspired chainable route definition syntax