Favicon of Elysia

Elysia

Elysia is a Bun-native TypeScript web framework offering end-to-end type safety, high performance, and an ergonomic API for building HTTP servers.

Elysia website screenshot
Elysia GitHub repository preview

Elysia is a web framework built for Bun, written in TypeScript. It targets developers who want a fast HTTP server with type safety that flows from the backend all the way to the client, without writing separate schema definitions or relying on code generation steps.

The framework's core pitch is a single source of truth for types: what you define on the server becomes the type contract consumed by clients, similar in spirit to tRPC's "move fast and break nothing" philosophy, but built specifically for Bun's runtime. It also claims strong raw throughput, citing TechEmpower benchmark results showing it significantly outperforming Express.

It's aimed at TypeScript developers building APIs, RPC-style backends, or full-stack apps who want compile-time guarantees about request and response shapes, and who are comfortable running on Bun rather than Node.js.

Key features

  • End-to-end type safety: Types defined on routes and handlers propagate through to clients, reducing the need for manual type duplication or codegen.
  • Bun-native performance: Built specifically to run on Bun, with benchmarks reported to be dramatically faster than Express under TechEmpower-style tests.
  • Frontend RPC connector: Supports calling backend routes from the frontend in an RPC-like manner using the same type definitions.
  • Unified documentation and types: The same type definitions that power runtime validation also drive generated documentation, keeping both in sync automatically.
  • Type-safe GraphQL support: Offers fully type-safe GraphQL integration from the same author behind GraphQL Mobius.
  • WinterCG compliance: Follows the WinterCG web-interoperable runtime standard, aiming for portability across compliant JavaScript runtimes.
  • Developer-experience focus: The API is designed around ergonomics and productivity rather than verbose configuration.
  • Active ecosystem: Described as one of the most widely used Bun-native web frameworks, with a surrounding plugin and community ecosystem.

Ideal use cases

Elysia fits projects that are already committed to, or willing to adopt, Bun as the runtime. It works well for building typed REST or RPC APIs where you want the client and server to share types without a separate contract layer, such as full-stack TypeScript apps, internal tooling APIs, or microservices that need to communicate with a typed frontend.

It's also a reasonable choice if you're building a GraphQL backend and want type safety baked in, or if raw HTTP throughput on Bun is a priority for your workload.

It is not the right choice if your deployment target is locked to Node.js only, or if you need a framework with the largest possible middleware ecosystem (Express and Fastify have more mature, battle-tested plugin libraries built over many years). Teams unfamiliar with Bun's tooling and deployment model should also budget time to learn that runtime before adopting Elysia in production.

Installation

The quickest way to start a new project is through Elysia's scaffolding command, which requires Bun installed on your machine:

bun create elysia app

This scaffolds a new Elysia application in the app directory with the necessary configuration and dependencies already wired up. From there, move into the project directory and run it with Bun's standard scripts (check the generated package.json for the exact dev/start commands).

For adding Elysia to an existing Bun project, install it as a dependency with Bun's package manager and import it directly in your TypeScript code to start defining routes. Full API documentation, guides, and plugin references are available on the project's documentation site.

Frequently asked questions

Share:

Stars
19.3K
Forks
606
Last commit
15 hours ago
Repository age
4 years
License
MIT
Self-hosted
No
Activity score
80/100
View Repository
Ad
Favicon

 

  
 

Similar to Elysia

Favicon

 

  
 
Favicon

 

  
 
Favicon