---
title: Hot reload an HTTP server
description: "Run a `Bun.serve()` server with `bun --hot` to reload its request handler on file changes without restarting the process."
sidebarTitle: Hot reload an HTTP server
mode: center
---

The [`--hot`](/runtime/watch-mode#hot-mode) flag runs a file with hot reloading enabled. When that file or a file it imports changes, Bun re-runs it. Bun does not watch files that no module imports, such as `.env`, `bunfig.toml`, and `tsconfig.json`. Restart Bun to apply a change to one of those files.

```sh terminal icon="terminal"
bun --hot run index.ts
```

---

Bun detects when you are running an HTTP server with `Bun.serve()`. It reloads your fetch handler when source files change, _without_ restarting the `bun` process. This makes hot reloads nearly instantaneous.

<Note>
Hot reloading doesn't reload the page in your browser.
</Note>
 
```ts index.ts icon="/icons/typescript.svg"
Bun.serve({
  port: 3000,
  fetch(req) {
    return new Response("Hello world");
  },
});
```
