Deploy Elysia on Vercel
Elysia can deploys on Vercel with zero configuration using either Bun or Node runtime.
- In src/index.ts, create or import an existing Elysia server
- Export the Elysia server as default export
typescript
import { Elysia, t } from 'elysia'
export default new Elysia()
.get('/', () => 'Hello Vercel Function')
.post('/', ({ body }) => body, {
body: t.Object({
name: t.String()
})
})- Develop locally with Vercel CLI
bash
vc dev- Deploy to Vercel
bash
vc deployThat's it. Your Elysia app is now running on Vercel.
pnpm
If you use pnpm, pnpm doesn't auto install peer dependencies by default forcing you to install additional dependencies manually.
bash
pnpm add @sinclair/typebox openapi-typesUsing Node.js
To deploy with Node.js, make sure to set type: module in your package.json
ts
{
"name": "elysia-app",
"type": "module"
}Using Bun
To deploy with Bun, make sure to set the runtime to Bun in your vercel.json
ts
{
"$schema": "https://openapi.vercel.sh/vercel.json",
"bunVersion": "1.x"
}If this doesn't work
Vercel has zero configuration for Elysia, for additional configuration, please refers to Vercel documentation