Nitro
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:
pnpm add -D vite-doctor
For a Vite-hosted Nitro project, register the Vite plugin:
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:
pnpm vite-doctor . --framework nitro --rules nitro
Check a Nitro 2 project against Nitro 3 before changing dependencies:
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:
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 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:
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.