Skip to main content
Next.js is a React framework for building full-stack web applications. It supports server-side rendering, static site generation, API routes, and more. Bun provides fast package installation and can run Next.js development and production servers.
1

Create a new Next.js app

Use the interactive CLI to create a new Next.js app. This will scaffold a new Next.js project and automatically install dependencies.
terminal
bun create next-app@latest my-bun-app
2

Start the dev server

Change to the project directory and run the dev server with Bun.
terminal
cd my-bun-app
bun --bun run dev
This starts the Next.js dev server with Bun’s runtime.Open http://localhost:3000 with your browser to see the result. Any changes you make to app/page.tsx will be hot-reloaded in the browser.
3

Update scripts in package.json

Modify the scripts field in your package.json by prefixing the Next.js CLI commands with bun --bun. This ensures that Bun executes the Next.js CLI for common tasks like dev, build, and start.
package.json
{
  "scripts": {
    "dev": "bun --bun next dev", 
    "build": "bun --bun next build", 
    "start": "bun --bun next start", 
  }
}

Hosting

Next.js applications on Bun can be deployed to various platforms.
https://mintcdn.com/bun-1dd33a4e-farm-a91c5779-shell-sandbox/CFA6Tagw86uhJFhY/icons/ecosystem/vercel.svg?fit=max&auto=format&n=CFA6Tagw86uhJFhY&q=85&s=bc86562517240f04f1762aea70b1dbbf

Vercel

Deploy on Vercel
https://mintcdn.com/bun-1dd33a4e-farm-a91c5779-shell-sandbox/CFA6Tagw86uhJFhY/icons/ecosystem/railway.svg?fit=max&auto=format&n=CFA6Tagw86uhJFhY&q=85&s=c4c56e6e0031eee88e3eb173c7253960

Railway

Deploy on Railway
https://mintcdn.com/bun-1dd33a4e-farm-a91c5779-shell-sandbox/CFA6Tagw86uhJFhY/icons/ecosystem/digitalocean.svg?fit=max&auto=format&n=CFA6Tagw86uhJFhY&q=85&s=f1c3820cb479ff086deedbd1bd684b02

DigitalOcean

Deploy on DigitalOcean
https://mintcdn.com/bun-1dd33a4e-farm-a91c5779-shell-sandbox/CFA6Tagw86uhJFhY/icons/ecosystem/aws.svg?fit=max&auto=format&n=CFA6Tagw86uhJFhY&q=85&s=5fe2ebfa7d9e47ac3e16f28a4b9361d6

AWS Lambda

Deploy on AWS Lambda
https://mintcdn.com/bun-1dd33a4e-farm-a91c5779-shell-sandbox/CFA6Tagw86uhJFhY/icons/ecosystem/gcp.svg?fit=max&auto=format&n=CFA6Tagw86uhJFhY&q=85&s=187f3aefdfc29b20217ae128961097f3

Google Cloud Run

Deploy on Google Cloud Run
https://mintcdn.com/bun-1dd33a4e-farm-a91c5779-shell-sandbox/CFA6Tagw86uhJFhY/icons/ecosystem/render.svg?fit=max&auto=format&n=CFA6Tagw86uhJFhY&q=85&s=dd8d1eb5da476796d73f5b86e103c57c

Render

Deploy on Render

Templates

bun-nextjs-basic

Bun + Next.js Basic Starter

A simple App Router starter with Bun, Next.js, and Tailwind CSS.
bun-nextjs-todo

Todo App with Next.js + Bun

A full-stack todo application built with Bun, Next.js, and PostgreSQL.

→ See Next.js’s official documentation for more information on building and deploying Next.js applications.