skills/bun-guides-deployment-vercel/SKILL.md
Deploy a Bun application on Vercel
npx skillsauth add jarle/bun-skills Bun Deploy a Bun application on VercelInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Vercel is a cloud platform that lets you build, deploy, and scale your apps.
<Warning> The Bun runtime is in Beta; certain features (e.g., automatic source maps, byte-code caching, metrics on `node:http/https`) are not yet supported. </Warning> <Note> `Bun.serve` is currently not supported on Vercel Functions. Use Bun with frameworks supported by Vercel, like Next.js, Express, Hono, or Nitro. </Note>```json vercel.json icon="file-json" theme={"theme":{"light":"github-light","dark":"dracula"}}
{
"bunVersion": "1.x" // [!code ++]
}
```
Vercel automatically detects this configuration and runs your application on Bun. The value has to be `"1.x"`, Vercel handles the minor version internally.
For best results, match your local Bun version with the version used by Vercel.
</Step>
<Step title="Next.js configuration">
If you’re deploying a **Next.js** project (including ISR), update your `package.json` scripts to use the Bun runtime:
```json package.json icon="file-json" theme={"theme":{"light":"github-light","dark":"dracula"}}
{
"scripts": {
"dev": "bun --bun next dev", // [!code ++]
"build": "bun --bun next build" // [!code ++]
}
}
```
<Note>
The `--bun` flag runs the Next.js CLI under Bun. Bundling (via Turbopack or Webpack) remains unchanged, but all commands execute within the Bun runtime.
</Note>
This ensures both local development and builds use Bun.
</Step>
<Step title="Deploy your app">
Connect your repository to Vercel, or deploy from the CLI:
```bash terminal icon="terminal" theme={"theme":{"light":"github-light","dark":"dracula"}}
# Using bunx (no global install)
bunx vercel login
bunx vercel deploy
```
Or install the Vercel CLI globally:
```bash terminal icon="terminal" theme={"theme":{"light":"github-light","dark":"dracula"}}
bun i -g vercel
vercel login
vercel deploy
```
[Learn more in the Vercel Deploy CLI documentation →](https://vercel.com/docs/cli/deploy)
</Step>
<Step title="Verify the runtime">
To confirm your deployment uses Bun, log the Bun version:
```ts index.ts icon="https://mintcdn.com/bun-1dd33a4e/nIz6GtMH5K-dfXeV/icons/typescript.svg?fit=max&auto=format&n=nIz6GtMH5K-dfXeV&q=85&s=5d73d76daf7eb7b158469d8c30d349b0" theme={"theme":{"light":"github-light","dark":"dracula"}}
console.log("runtime", process.versions.bun);
```
```txt theme={"theme":{"light":"github-light","dark":"dracula"}}
runtime 1.3.3
```
[See the Vercel Bun Runtime documentation for feature support →](https://vercel.com/docs/functions/runtimes/bun#feature-support)
</Step>
</Steps>
nodejs:export const config = { runtime: "nodejs" }; // [!code ++]
development
Using TypeScript with Bun, including type definitions and compiler options
development
Learn how to write tests using Bun's Jest-compatible API with support for async tests, timeouts, and various test modifiers
testing
Learn how to use snapshot testing in Bun to save and compare output between test runs
testing
Learn about Bun test's runtime integration, environment variables, timeouts, and error handling