General

Core options for presets, logging, and runtime configuration.

Note

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

import { defineConfig } from "nitro";

#preset

The deployment preset to build for in production. Can also be set with the NITRO_PRESET environment variable.

The preset for development mode is always nitro_dev. For production, the default is node_server, which builds a standalone Node.js server.

When the preset option is not set and Nitro is running in a known environment, the preset is detected automatically.

export default defineConfig({
  preset: "cloudflare_pages", // deploy to Cloudflare Pages
});

#defaultPreset

Customize the preset used as the fallback when preset is not set and none of the known hosting providers are auto-detected.

By default, Nitro falls back to the runtime-based preset (node, and deno or bun when running on those runtimes). An explicit preset, the NITRO_PRESET environment variable, and auto-detected providers (Vercel, Netlify, Cloudflare Pages, ...) all take precedence over defaultPreset.

It accepts a preset name or an inline preset definition.

export default defineConfig({
  defaultPreset: "node_cluster", // use node_cluster instead of node_server by default
});

#debug

  • Default: false (true when DEBUG environment variable is set)

Enable debug mode for verbose logging and additional development information.

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

#logLevel

  • Default: 3 (1 when the testing environment is detected)

Log verbosity level. See consola for more information.

export default defineConfig({
  logLevel: 4, // verbose logging
});

#logging

  • Default: { compressedSizes: true, buildSuccess: true }

Control build logging behavior. Set compressedSizes to false to skip reporting compressed bundle sizes. Set buildSuccess to false to suppress the build success message.

export default defineConfig({
  logging: {
    compressedSizes: false, // skip compressed size reporting
    buildSuccess: false,
  },
});

#runtimeConfig

  • Default: { app: {}, nitro: {} }

Server runtime configuration. Nitro injects app.baseURL (from the baseURL option) into the app namespace.

Note: The app and nitro namespaces are reserved for internal use.

export default defineConfig({
  runtimeConfig: {
    apiSecret: "default-secret", // override with NITRO_API_SECRET
  },
});

#compatibilityDate

  • Default: "latest" behavior when not provided

Deployment providers introduce new features that Nitro presets can leverage, but some of them need to be explicitly opted into. Set this to the latest date you have tested against, in YYYY-MM-DD format, to leverage the latest preset features.

export default defineConfig({
  compatibilityDate: "2025-01-01",
});

#static

  • Default: false

Enable static site generation mode.

export default defineConfig({
  static: true, // prerender all routes
});

Nitro  builds full-stack servers that deploy anywhere.