Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
.vercel
.DS_Store
bootstrap
dist
node_modules
project.json
10 changes: 0 additions & 10 deletions Makefile

This file was deleted.

56 changes: 17 additions & 39 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,14 @@ Run [Bun](https://bun.sh) on Vercel Serverless Functions
> This is an experimental project and should not be used in production. This project is not endorsed by Vercel.

```typescript
// 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" }
})
}
// api/index.ts
export default function handler(req: Request) {
return new Response(
JSON.stringify({ message: `Hello from bun@${Bun.version}` }),
{
headers: { "Content-Type": "application/json" },
},
)
}
```

Expand All @@ -29,42 +27,22 @@ There are two ways to deploy your project to Vercel:

### GitHub Integration

> Note: An issue in Bun must be resolved before this method is fully operational

#### 1. Update your package.json with `bun-vercel`

```json
{
"devDependencies": {
"bun-vercel": "^1.0.0-alpha.4",
}
}
```

#### 2. Update the `build` script run bun-vercel
Update your vercel.json with `bun-vercel`

```json
{
"scripts": {
"build": "bun-vercel ./src/main.ts"
"$schema": "https://openapi.vercel.sh/vercel.json",
"functions": {
"api/index.ts": {
"runtime": "[email protected]"
}
}
}
```

#### 3. Add a `vercel.json` with your build command

```json
{
"buildCommand": "bun run build"
}
```

### Manually

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

1. Install the Vercel CLI and run `vercel link`
2. Run `bun run build`
3. Run `vercel deploy --prebuilt --prod`
2. Run `vercel pull`
3. Run `vercel build`
4. Run `vercel deploy --prebuilt --prod`
Loading