Build an app with Next.js and Bun
Next.js is a React framework for building full-stack web applications. It supports server-side rendering, static site generation, and API routes. Bun installs packages fast and can run Next.js development and production servers.
- Create a new Next.js app
Use the interactive CLI to scaffold a new Next.js project and install its dependencies.
terminalbun create next-app@latest my-bun-app - Start the dev server
Change to the project directory and run the dev server with Bun.
terminalcd my-bun-app bun --bun run devThis starts the Next.js dev server with Bun's runtime.
Open
http://localhost:3000in your browser to see the result. Changes you make toapp/page.tsxare hot-reloaded in the browser. - Update scripts in package.json
Prefix the Next.js CLI commands in your
package.jsonscripts withbun --bunso that Bun executes the Next.js CLI fordev,build, andstart.package.json{ "scripts": { "dev": "bun --bun next dev", // [!code ++] "build": "bun --bun next build", // [!code ++] "start": "bun --bun next start" // [!code ++] } }
Hosting
Deploy on Vercel
Deploy on Railway
Deploy on DigitalOcean
Deploy on AWS Lambda
Deploy on Google Cloud Run
Deploy on Render
Templates
A basic App Router starter with Bun, Next.js, and Tailwind CSS.
A full-stack todo application built with Bun, Next.js, and PostgreSQL.
Refer to the Next.js documentation for more on building and deploying Next.js applications.