Skip to content
Our Sponsors
Open in Anthropic

Deploy Elysia on Vercel

Elysia can deploys 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 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()
        })
    })
  1. Develop locally with Vercel CLI
bash
vc dev
  1. Deploy to Vercel
bash
vc deploy

That'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-types

Using 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