> ## Documentation Index
> Fetch the complete documentation index at: https://bun-1dd33a4e-farm-ad2450b3-transpiler-cache-version-namespa.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Build an app with Next.js and Bun

[Next.js](https://nextjs.org/) 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.

***

<Steps>
  <Step title="Create a new Next.js app">
    Use the interactive CLI to scaffold a new Next.js project and install its dependencies.

    ```sh terminal icon="terminal" theme={"theme":{"light":"github-light","dark":"dracula"}}
    bun create next-app@latest my-bun-app
    ```
  </Step>

  <Step title="Start the dev server">
    Change to the project directory and run the dev server with Bun.

    ```sh terminal icon="terminal" theme={"theme":{"light":"github-light","dark":"dracula"}}
    cd my-bun-app
    bun --bun run dev
    ```

    This starts the Next.js dev server with Bun's runtime.

    Open [`http://localhost:3000`](http://localhost:3000) in your browser to see the result. Changes you make to `app/page.tsx` are hot-reloaded in the browser.
  </Step>

  <Step title="Update scripts in package.json">
    Prefix the Next.js CLI commands in your `package.json` scripts with `bun --bun` so that Bun executes the Next.js CLI for `dev`, `build`, and `start`.

    ```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 ++]
        "start": "bun --bun next start", // [!code ++]
      }
    }
    ```
  </Step>
</Steps>

***

## Hosting

<Columns cols={3}>
  <Card title="Vercel" href="/guides/deployment/vercel" icon="https://mintcdn.com/bun-1dd33a4e-farm-ad2450b3-transpiler-cache-version-namespa/pVrMBuZvntvIe2NO/icons/ecosystem/vercel.svg?fit=max&auto=format&n=pVrMBuZvntvIe2NO&q=85&s=04d417684c06e59512f2611053a15ac1" width="24" height="24" data-path="icons/ecosystem/vercel.svg">
    Deploy on Vercel
  </Card>

  <Card title="Railway" href="/guides/deployment/railway" icon="https://mintcdn.com/bun-1dd33a4e-farm-ad2450b3-transpiler-cache-version-namespa/pVrMBuZvntvIe2NO/icons/ecosystem/railway.svg?fit=max&auto=format&n=pVrMBuZvntvIe2NO&q=85&s=db3e612add893a3d019d47a235a6a8a7" width="24" height="24" data-path="icons/ecosystem/railway.svg">
    Deploy on Railway
  </Card>

  <Card title="DigitalOcean" href="/guides/deployment/digital-ocean" icon="https://mintcdn.com/bun-1dd33a4e-farm-ad2450b3-transpiler-cache-version-namespa/pVrMBuZvntvIe2NO/icons/ecosystem/digitalocean.svg?fit=max&auto=format&n=pVrMBuZvntvIe2NO&q=85&s=e3c124b5324c3a7bc1937ae0e4548c5c" width="24" height="24" data-path="icons/ecosystem/digitalocean.svg">
    Deploy on DigitalOcean
  </Card>

  <Card title="AWS Lambda" href="/guides/deployment/aws-lambda" icon="https://mintcdn.com/bun-1dd33a4e-farm-ad2450b3-transpiler-cache-version-namespa/pVrMBuZvntvIe2NO/icons/ecosystem/aws.svg?fit=max&auto=format&n=pVrMBuZvntvIe2NO&q=85&s=d5080164234846a89580e0aacbaca8a8" width="24" height="24" data-path="icons/ecosystem/aws.svg">
    Deploy on AWS Lambda
  </Card>

  <Card title="Google Cloud Run" href="/guides/deployment/google-cloud-run" icon="https://mintcdn.com/bun-1dd33a4e-farm-ad2450b3-transpiler-cache-version-namespa/pVrMBuZvntvIe2NO/icons/ecosystem/gcp.svg?fit=max&auto=format&n=pVrMBuZvntvIe2NO&q=85&s=d80761f6f510b7b8296232413ec3d48a" width="24" height="24" data-path="icons/ecosystem/gcp.svg">
    Deploy on Google Cloud Run
  </Card>

  <Card title="Render" href="/guides/deployment/render" icon="https://mintcdn.com/bun-1dd33a4e-farm-ad2450b3-transpiler-cache-version-namespa/pVrMBuZvntvIe2NO/icons/ecosystem/render.svg?fit=max&auto=format&n=pVrMBuZvntvIe2NO&q=85&s=5329763afb79d85f21f8ef40be8d23a2" width="24" height="24" data-path="icons/ecosystem/render.svg">
    Deploy on Render
  </Card>
</Columns>

***

## Templates

<Columns cols={2}>
  <Card title="Bun + Next.js Basic Starter" img="https://mintcdn.com/bun-1dd33a4e-farm-ad2450b3-transpiler-cache-version-namespa/pVrMBuZvntvIe2NO/images/templates/bun-nextjs-basic.png?fit=max&auto=format&n=pVrMBuZvntvIe2NO&q=85&s=a22847c324c176bedcc1dc600bc47875" href="https://github.com/bun-templates/bun-nextjs-basic" arrow="true" cta="Go to template" width="2212" height="1326" data-path="images/templates/bun-nextjs-basic.png">
    A simple App Router starter with Bun, Next.js, and Tailwind CSS.
  </Card>

  <Card title="Todo App with Next.js + Bun" img="https://mintcdn.com/bun-1dd33a4e-farm-ad2450b3-transpiler-cache-version-namespa/pVrMBuZvntvIe2NO/images/templates/bun-nextjs-todo.png?fit=max&auto=format&n=pVrMBuZvntvIe2NO&q=85&s=8a20ea29db06810555f12c677a1fc435" href="https://github.com/bun-templates/bun-nextjs-todo" arrow="true" cta="Go to template" width="2212" height="1326" data-path="images/templates/bun-nextjs-todo.png">
    A full-stack todo application built with Bun, Next.js, and PostgreSQL.
  </Card>
</Columns>

***

Refer to the [Next.js documentation](https://nextjs.org/docs) for more on building and deploying Next.js applications.
