Skip to content

nestjs-platform-elysia

NestJS HTTP adapter on top of Elysia & Bun. DI, guards, pipes, interceptors, exception filters — plus TypeBox validation, lifecycle hooks, and the Elysia plugin ecosystem.

NestJS gives you DI, modules, guards, pipes, interceptors, exception filters, and a clear architecture. Elysia gives you Bun-native performance, TypeBox validation at the framework level, lifecycle hooks, and a rich plugin ecosystem.

This adapter lets you keep both: write Nest controllers as usual while still being able to register Elysia plugins, attach TypeBox schemas to routes, mount sub-apps, and use app.handle() for testing — without losing what makes Elysia worth choosing.

Full Nest pipeline

Guards, pipes, interceptors and exception filters work end-to-end. Drop-in compatible with the AbstractHttpAdapter contract.

Bun-native

Runs on Bun.serve() via Elysia. No Node.js compatibility layer in between.

TypeBox / Zod at the route level

@RouteSchema attaches an Elysia schema to a controller method. Invalid bodies return 422 before your controller ever runs.

Native WebSocket gateways

@WebSocketGateway() is bridged to Elysia’s app.ws() on the same Bun server. No second port, no ws library needed.

Trust proxy out of the box

Opt-in X-Forwarded-For / X-Forwarded-Host / X-Forwarded-Proto resolution with a custom resolver hook.

Webhook-ready body parsing

useBodyParser() captures the raw request buffer onto req.rawBody for signature verification, and lets you register custom parsers per content-type.

Terminal window
bun add nestjs-platform-elysia @nestjs/common @nestjs/core elysia
import { NestFactory } from '@nestjs/core';
import { ElysiaAdapter, type NestElysiaApplication } from 'nestjs-platform-elysia';
import { AppModule } from './app.module';
const app = await NestFactory.create<NestElysiaApplication>(AppModule, new ElysiaAdapter());
await app.listen(3000);

Continue with the Getting Started guide.