Advanced

Low-level options. Most projects should not need to change these.

Note

All examples on this page assume the following import in nitro.config.ts:

import { defineConfig } from "nitro";

#dev

  • Default: true for development and false for production

Warning

This is an advanced configuration. Things can go wrong if misconfigured.

export default defineConfig({
  dev: true, // force development mode behavior
});

#typescript

  • Default: {}

TypeScript options. tsConfig is the config used by the bundler for JSX options and path aliases and defaults to the project's tsconfig.json. tsconfigPaths (default: true) resolves its path aliases (compilerOptions.paths) for the server sources.

export default defineConfig({
  typescript: {
    tsConfig: {
      compilerOptions: {
        jsx: "react-jsx",
      },
    },
  },
});

#hooks

Warning

This is an advanced configuration. Things can go wrong if misconfigured.

Nitro hooks. See hookable for more information.

export default defineConfig({
  hooks: {
    compiled(nitro) {
      console.log("Build compiled successfully!");
    },
  },
});

Hooks with the same name do not override each other. Hooks defined by the deployment preset run first, then hooks from your config. Defining a hook with the same name no longer disables the preset's hook.

Read more in Docs > Lifecycle.

#commands

Warning

This is an advanced configuration. Things can go wrong if misconfigured.

Preview and deploy command hints are usually filled by deployment presets.

deploy can be a shell command (./ paths are resolved relative to the output directory) or a function receiving the Nitro instance, used by presets that deploy programmatically. Both are run by nitro deploy and the deploy builder API.

export default defineConfig({
  commands: {
    preview: "node ./server/index.mjs",
    deploy: "npx wrangler deploy ./server/index.mjs",
  },
});

#devErrorHandler

Warning

This is an advanced configuration. Things can go wrong if misconfigured.

A custom error handler function for development errors.

export default defineConfig({
  devErrorHandler: (error, event) => {
    return new Response(`Dev error: ${error.message}`, { status: 500 });
  },
});

#tracingChannel

🧪 Experimental!

  • Type: boolean | { srvx?: boolean, h3?: boolean, unstorage?: boolean, db0?: boolean }
  • Default: false

The tracingChannel option enables TracingChannel instrumentation for request handling. It is wired for Node.js and also works in Bun, Deno, and the development preset, any runtime that exposes node:diagnostics_channel. The published srvx.request and h3.request channels remain available across these runtimes and can be consumed by APM tools and custom subscribers.

Pass true to enable every channel, or an object to toggle them individually.

export default defineConfig({
  tracingChannel: true,
});

#framework

  • Default: { name: "nitro", version: "<current>" }

Framework information. Used by presets and build info. Typically set by higher-level frameworks (e.g. Nuxt).

export default defineConfig({
  framework: { name: "my-framework", version: "2.0.0" },
});

#manifest

Build manifest options. Use deploymentId to include a custom deployment identifier in the build manifest (some presets fill it automatically from platform environment variables).

export default defineConfig({
  manifest: { deploymentId: process.env.DEPLOY_ID },
});

Nitro  builds full-stack servers that deploy anywhere.