Skip to main content
Elysia is a TypeScript web framework built for Bun. It takes full advantage of Bun’s HTTP, file system, and hot reloading APIs, and is one of the fastest Bun HTTP frameworks.

Quick start

Scaffold a new Elysia project with bun create:

Manual setup

1

Install Elysia

2

Create a server

src/index.ts
3

Run the server

Routing

Elysia uses a chainable API for defining routes:

Schema validation

Elysia provides end-to-end type safety through its t schema validation module. Schemas are validated at runtime and inferred as TypeScript types automatically:
If the request body does not match the schema, Elysia returns a 400 Bad Request with a descriptive error.

Middleware (lifecycle hooks)

Use Elysia’s lifecycle hooks to run code before or after route handlers:

Plugins

Elysia has a plugin system for sharing routes, middleware, and state across your app:
Popular community plugins include:
  • @elysiajs/bearer — Bearer token extraction
  • @elysiajs/cors — CORS configuration
  • @elysiajs/jwt — JWT authentication
  • @elysiajs/swagger — OpenAPI / Swagger UI generation
  • @elysiajs/trpc — tRPC adapter
Install any of them with bun add:
See the Elysia documentation for the complete API reference, including WebSocket support, file uploads, and server-sent events.