Skip to content

Deploy Elysia on Vercel

Elysia can be deployed on Vercel with zero configuration using either Bun or Node runtime.

  1. In src/index.ts, create or import an existing Elysia server
  2. Export the Elysia server as the default export
import { Elysia, t } from 'elysia'
export default new Elysia()
.get('/', () => 'Hello Vercel Function')
.post('/', {
body: t.Object({
name: t.String()
})
}, ({ body }) => body)
  1. Develop locally with the Vercel CLI
Terminal window
vc dev
  1. Deploy to Vercel
Terminal window
vc deploy

That’s it. Your Elysia app is now running on Vercel.

If your pnpm configuration does not install peer dependencies, add the peers required by Elysia v2 explicitly:

Terminal window
pnpm add typebox exact-mirror openapi-types

To deploy with Node.js, make sure to set type: module in your package.json

package.json
{
"name": "elysia-app",
"type": "module"
}

To deploy with Bun, make sure to set the runtime to Bun in your vercel.json

vercel.json
{
"$schema": "https://openapi.vercel.sh/vercel.json",
"bunVersion": "1.x"
}

Vercel has zero-configuration support for Elysia. For additional configuration, please refer to the Vercel documentation

Type to search the documentation.

    Up arrowDown arrow to navigateEnter to selectEscape to close