Elysia is built for Bun from the ground up. End-to-end type safety, 18x faster than Express, and a plugin ecosystem that covers auth, Swagger, and WebSockets.
Why Another Web Framework?
Express is 14 years old. It was built for callback-style Node.js. No TypeScript types, no validation, no documentation generation.
Fastify improved performance but kept the Node.js overhead.
Elysia: built specifically for Bun, with TypeScript as a first-class citizen.
What You Get for Free
import { Elysia, t } from 'elysia';
const app = new Elysia()
.get('/', () => 'Hello World')
.get('/user/:id', ({ params: { id } }) => getUser(id))
.post('/user', ({ body }) => createUser(body), {
body: t.Object({
name: t.String(),
email: t.String({ format: 'email' }),
})
})
.listen(3000);
End-to-end type safety — route params, query, body, response — all typed
Validation built-in — TypeBox schemas validate AND generate TypeScript types
18x faster than Express — Bun's HTTP server + Elysia's optimized router
Swagger auto-generation — app.use(swagger()) → instant API docs
Performance
Requests/second (hello world benchmark):
- Express: ~15,000 req/s
- Fastify: ~60,000 req/s
- Elysia: ~270,000 req/s
This isn't synthetic — Bun's HTTP implementation is fundamentally faster.
Plugin System
import { Elysia } from 'elysia';
import { swagger } from '@elysiajs/swagger';
import { jwt } from '@elysiajs/jwt';
import { cors } from '@elysiajs/cors';
const app = new Elysia()
.use(swagger())
.use(jwt({ secret: 'your-secret' }))
.use(cors())
.get('/protected', ({ jwt, set }) => {
// jwt is typed and available
})
.listen(3000);
Eden Treaty (Type-Safe Client)
Elysia generates a type-safe client automatically:
import { treaty } from '@elysiajs/eden';
import type { App } from './server';
const client = treaty<App>('localhost:3000');
const { data } = await client.user({ id: '123' }).get();
// data is fully typed based on your server routes
Like tRPC, but for REST APIs.
If you're starting a new API and want maximum performance with minimum code — Elysia on Bun is the fastest path.
Need web scraping or data extraction? Check out my tools on Apify — get structured data from any website in minutes.
Custom solution? Email spinov001@gmail.com — quote in 2 hours.
Top comments (0)