Elysia

Elysia

elysiajs.com

2

About this website

Elysia is a backend TypeScript framework built for the Bun runtime, created by a developer known as SaltyAom. According to TechEmpower Framework Benchmark Round 22, an Elysia server running on Bun handles 2,454,631 plaintext requests per second, compared to 676,019 for Go Gin, 506,087 for Java Spring, 415,600 for Node Fastify, and 113,117 for Node Express. The framework defines each route schema once using builder methods, and that single schema definition drives four concerns at compile time: request body validation, TypeScript type narrowing inside handlers, automatic OpenAPI 3.0 specification generation without annotations, and type-safe client inference via the Eden treaty module which mirrors tRPC's end-to-end typing pattern. Elysia accepts TypeBox, Zod, Valibot, ArkType, and Effect validators through a unified interface, passing inferred types to OpenAPI property definitions without manual conversion. The router supports file responses with automatic MIME detection, streaming via async generators with yield syntax, and bidirectional WebSocket through the microWebSocket adapter wrapping Bun's native WebSocket API. The lifecycle system exposes 13 named stages including onRequest, onBeforeHandle, onAfterHandle, onError, onResponse, and Derive for injecting scoped context into handler closures. Instance composition via .use with pattern-based path prefixing allows route groups to be split across files while maintaining shared state and type inference. The .guard method applies middleware to route groups with compile-time validation of the guard return type. OpenTelemetry tracing instruments every lifecycle hook and external call with span context propagation. Elysia runs on Bun, Node.js 18 and above, and Cloudflare Workers by targeting the Fetch API standard. Jarred Sumner, creator of Bun, has sponsored Elysia for three years through GitHub Sponsors. The Bank for Agriculture and Agricultural Cooperatives of Thailand uses Elysia in production banking systems.

Tags & Categories

Statistics

2
Views
0
Clicks
0
Like
0
Dislike

Comments

Log In to post a comment

No comments yet. Be the first!