Run Bun on Vercel Serverless Functions
https://bun-vercel.vercel.app/
This is an experimental project and should not be used in production. This project is not endorsed by Vercel.
// src/main.ts
import { type Server } from "bun"
export default {
async fetch(request: Request, server: Server) {
return new Response("Hello from Bun on Vercel", {
status: 200,
headers: { "Content-Type": "text/plain" }
})
}
}
There are two ways to deploy your project to Vercel:
- GitHub integration
- Manually from your computer
Note: An issue in Bun must be resolved before this method is fully operational
{
"devDependencies": {
"bun-vercel": "^1.0.0-alpha.4",
}
}
{
"scripts": {
"build": "bun-vercel ./src/main.ts"
}
}
{
"buildCommand": "bun run build"
}
Before starting you should follow the same setup steps as the GitHub integration, as they will be needed regardless.
Note: To deploy from your computer you must have Docker installed so we can build for Amazon Linux
- Install the Vercel CLI and run
vercel link
- Run
bun run build
- Run
vercel deploy --prebuilt --prod