# Build a frontend using Vite and Bun (/docs/guides/ecosystem/vite)

<!-- agent-signals: reading_time_min: 1 · est_tokens: 372 · updated: 2026-07-28 -->
Related: [Build an app with Astro and Bun](/docs/guides/ecosystem/astro.md), [Create a Discord bot](/docs/guides/ecosystem/discordjs.md), [Containerize a Bun application with Docker](/docs/guides/ecosystem/docker.md), [Use Drizzle ORM with Bun](/docs/guides/ecosystem/drizzle.md), [Use Gel with Bun](/docs/guides/ecosystem/gel.md), [Build an HTTP server using Elysia and Bun](/docs/guides/ecosystem/elysia.md)

<Note>
  You can use Vite with Bun, but many projects get faster builds & drop hundreds of dependencies by switching to [HTML
  imports](/bundler/html-static).
</Note>

***

Vite works with Bun with no extra configuration. Get started with one of Vite's templates.

```bash terminal icon="terminal"
bun create vite my-app
```

```txt
✔ Select a framework: › React
✔ Select a variant: › TypeScript + SWC
Scaffolding project in /path/to/my-app...
```

***

Then `cd` into the project directory and install dependencies.

```bash terminal icon="terminal"
cd my-app
bun install
```

***

Start the development server with the `vite` CLI using `bunx`.

The `--bun` flag tells Bun to run Vite's CLI using `bun` instead of `node`; by default Bun respects Vite's `#!/usr/bin/env node` [shebang line](https://en.wikipedia.org/wiki/Shebang_\(Unix\)).

```bash terminal icon="terminal"
bunx --bun vite
```

***

To simplify this command, update the `"dev"` script in `package.json` to the following.

```json package.json icon="file-json"
  "scripts": {
    "dev": "vite", // [!code --]
    "dev": "bunx --bun vite", // [!code ++]
    "build": "vite build",
    "serve": "vite preview"
  },
  // ...
```

***

Now you can start the development server with `bun run dev`.

```bash terminal icon="terminal"
bun run dev
```

***

Build your app for production.

```sh terminal icon="terminal"
bunx --bun vite build
```

***

For more information, see the [Vite documentation](https://vite.dev/guide/).
