---
title: "Nitro"
description: "Install Doctor for Nitro server code and run request, runtime config, and server-boundary diagnostics."
canonical_url: "https://vite-doctor.onmax.me/nitro"
---
# Nitro

> Install Doctor for Nitro server code and run request, runtime config, and server-boundary diagnostics.

Use Nitro rules for server handlers, request helpers, runtime config access, and boundaries between server code and client-only APIs.

Doctor resolves the installed Nitro package and follows it to the H3 instance Nitro owns. Runtime-specific rules activate from those exact versions, including prereleases, while unresolved or custom package identities suppress version-specific advice instead of guessing.

## Install

Add Vite Doctor to the project:

```bash
pnpm add -D vite-doctor
```

For a Vite-hosted Nitro project, register the Vite plugin:

```ts [vite.config.ts]
import { doctor } from "vite-doctor";
import { defineConfig } from "vite";

export default defineConfig({
  plugins: [doctor()],
});
```

Set `framework: "nitro"` only when Doctor cannot identify the Nitro app automatically.

Run Doctor directly when you want a focused Nitro Doctor Run:

```bash
pnpm vite-doctor . --framework nitro --rules nitro
```

Check a Nitro 2 project against Nitro 3 before changing dependencies:

```bash
pnpm dlx vite-doctor migrate . --to nitro@3
```

The migration command keeps Nitro 3 and H3 v2 source changes with the dependency change that activates them, then lists checks that must wait until the new runtime is installed. It does not modify source or package files.

## Configure

Keep Nitro rule policy on the Doctor surface that runs the project:

```ts [vite.config.ts]
import { doctor } from "vite-doctor";
import { defineConfig } from "vite";

export default defineConfig({
  plugins: [
    doctor({
      extends: ["nitro/recommended"],
      config: {
        rules: {
          "nitro/request/prefer-validated-body": "warn",
        },
      },
    }),
  ],
});
```

## Pick the right reference

Nitro rules focus on request validation, runtime config, internal fetches, redirects, and server-only execution. Start in [Nitro rules](https://vite-doctor.onmax.me/nitro/rules) when a diagnostic begins with `nitro/`.

In Nuxt projects, Nitro diagnostics can appear during a Nuxt Doctor run because Nuxt owns server routes through Nitro.

## Fix a diagnostic

Open the rule page from the reported rule ID and re-run only the failing Nitro rule while you edit:

```bash
pnpm vite-doctor . --framework nitro --rules nitro/request/prefer-validated-body
```

Prefer framework helpers such as `readValidatedBody(event, schema.parse)` when a rule points at request parsing or validation.

---

- [Nitro rules](https://vite-doctor.onmax.me/nitro/rules)
- [CLI](https://vite-doctor.onmax.me/cli)


## Sitemap

See the full [sitemap](https://vite-doctor.onmax.me/sitemap.md) for all pages.
