Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/elysiajs/documentation/llms.txt

Use this file to discover all available pages before exploring further.

Elysia provides a runtime adapter system that lets you run the same application code across multiple JavaScript runtimes. The Node adapter bridges Elysia’s Web Standard internals to Node.js HTTP, so you can deploy to any Node.js-compatible environment without rewriting your application.
1

Install Elysia and the Node adapter

bun add elysia @elysia/node
2

Apply the adapter to your Elysia instance

Import node from @elysia/node and pass it as the adapter option when constructing your app.
import { Elysia } from 'elysia'
import { node } from '@elysia/node'

const app = new Elysia({ adapter: node() })
  .get('/', () => 'Hello Elysia')
  .listen(3000)
3

(Optional) Add tsx for development hot-reload

Install tsx, @types/node, and typescript as dev dependencies for a development experience similar to bun dev.
bun add -d tsx @types/node typescript
4

Add scripts to package.json

{
  "scripts": {
    "dev": "tsx watch src/index.ts",
    "build": "tsc src/index.ts --outDir dist",
    "start": "NODE_ENV=production node dist/index.js"
  }
}
  • dev — Start with auto-reload on code changes.
  • build — Compile TypeScript for production.
  • start — Run the compiled production server.
5

Initialize TypeScript with strict mode

tsc --init
Then set strict to true in the generated tsconfig.json:
{
  "compilerOptions": {
    "strict": true
  }
}

pnpm peer dependencies

If you use pnpm, peer dependencies are not installed automatically. Install them manually:
pnpm add @sinclair/typebox openapi-types

Build docs developers (and LLMs) love