NitroOptions
Extends
Omit<NitroPluginConfig,"serverDir">
Properties
_cli?
optional_cli?:object
command?
optionalcommand?:string
Inherited from
Omit._cli
_nitro?
optional_nitro?:Nitro
Internal
Use preinitialized Nitro instance for the plugin.
Inherited from
Omit._nitro
$development?
optional$development?:NitroConfig
Inherited from
Omit.$development
$env?
optional$env?:Record<string,NitroConfig>
Inherited from
Omit.$env
$meta?
optional$meta?:ConfigLayerMeta
Inherited from
Omit.$meta
$production?
optional$production?:NitroConfig
Inherited from
Omit.$production
$test?
optional$test?:NitroConfig
Inherited from
Omit.$test
alias?
optionalalias?:Record<string,string>
Path aliases for module resolution.
Example
alias: {
"~utils": "./src/utils",
"#shared": "./shared",
}See
https://nitro.build/config#alias
Inherited from
Omit.alias
apiBaseURL?
optionalapiBaseURL?:string
Base URL prefix for API routes.
Default
"/api"See
https://nitro.build/config#apibaseurl
Inherited from
Omit.apiBaseURL
apiDir?
optionalapiDir?:string
Directory name to scan for API route handlers.
Default
"api"See
https://nitro.build/config#apidir
Inherited from
Omit.apiDir
awsAmplify?
optionalawsAmplify?:AWSAmplifyOptions
Inherited from
Omit.awsAmplify
awsLambda?
optionalawsLambda?:AwsLambdaOptions
Inherited from
Omit.awsLambda
azure?
optionalazure?:AzureOptions
Inherited from
Omit.azure
baseURL?
optionalbaseURL?:string
Server's main base URL prefix.
Can also be set via the NITRO_APP_BASE_URL environment variable.
Default
"/"See
https://nitro.build/config#baseurl
Inherited from
Omit.baseURL
buildDir?
optionalbuildDir?:string
Nitro's temporary working directory for build-related files.
Default
"node_modules/.nitro"See
https://nitro.build/config#builddir
Inherited from
Omit.buildDir
builder?
optionalbuilder?:"rollup"|"rolldown"|"vite"
Bundler to use for production builds.
Auto-detected when not set: "vite" if a vite.config with the nitro() plugin is found, otherwise "rolldown" (bundled with Nitro). Use the NITRO_BUILDER environment variable as an alternative.
See
https://nitro.build/config#builder
Inherited from
Omit.builder
cloudflare?
optionalcloudflare?:CloudflareOptions
Inherited from
Omit.cloudflare
commands?
optionalcommands?:object
Preview and deploy command hints (usually filled by deployment presets).
deploy?
optionaldeploy?:string
preview?
optionalpreview?:string
Command to preview the production build locally.
See
https://nitro.build/config#commands
Inherited from
Omit.commands
commonJS?
optionalcommonJS?:any
Additional configuration for the Rollup CommonJS plugin.
See
https://nitro.build/config#commonjs
Inherited from
Omit.commonJS
compatibilityDate?
optionalcompatibilityDate?:CompatibilityDateSpec
Inherited from
Omit.compatibilityDate
compressPublicAssets?
optionalcompressPublicAssets?:boolean|CompressOptions
Pre-compress public assets and prerendered routes.
Generates gzip and brotli (and zstd when available) variants of compressible assets larger than 1024 bytes. Pass an object to selectively enable/disable each encoding.
See
https://nitro.build/config#compresspublicassets
Inherited from
Omit.compressPublicAssets
database?
optionaldatabase?:DatabaseConnectionConfigs
Database connection configurations.
Requires experimental.database: true.
See
Inherited from
Omit.database
debug?
optionaldebug?:boolean
Enables debugging nitro (build time) hooks in the console.
See
https://nitro.build/config#debug
Inherited from
Omit.debug
defaultPreset?
optionaldefaultPreset?:NitroPreset|PresetNameInput
Customize the preset used as the fallback when no preset is 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 this.
Accepts a preset name or an inline preset definition.
See
https://nitro.build/config#defaultpreset
Inherited from
Omit.defaultPreset
dev?
optionaldev?:boolean
Whether the current build targets development mode.
Defaults to true during development and false for production.
See
https://nitro.build/config#dev
Inherited from
Omit.dev
devDatabase?
optionaldevDatabase?:DatabaseConnectionConfigs
Database connection overrides for development mode.
See
Inherited from
Omit.devDatabase
devErrorHandler?
optionaldevErrorHandler?:NitroErrorHandler
Custom error handler function for development mode.
See
https://nitro.build/config#deverrorhandler
Inherited from
Omit.devErrorHandler
devHandlers?
optionaldevHandlers?:NitroDevEventHandler[]
Development-only event handlers with inline handler functions.
Not included in production builds.
See
https://nitro.build/config#devhandlers
Inherited from
Omit.devHandlers
devProxy?
optionaldevProxy?:Record<string,string|ProxyServerOptions>
Proxy configuration for the development server.
A map of path prefixes to proxy target URLs or options.
Example
devProxy: {
"/proxy/test": "http://localhost:3001",
"/proxy/example": { target: "https://example.com", changeOrigin: true },
}See
Inherited from
Omit.devProxy
devServer?
optionaldevServer?:object
Development server options.
hostname?
optionalhostname?:string
port?
optionalport?:number
Port number for the dev server.
runner?
optionalrunner?:RunnerName
watch?
optionalwatch?:string[]
See
https://nitro.build/config#devserver
Inherited from
Omit.devServer
devStorage?
optionaldevStorage?:StorageMounts
Storage mount overrides for development mode.
Useful for swapping production drivers (e.g. Redis) with local alternatives (e.g. filesystem) during development.
See
Inherited from
Omit.devStorage
enabled?
optionalenabled?:boolean
entry?
optionalentry?:string
Bundler entry point path.
See
https://nitro.build/config#entry
Inherited from
Omit.entry
errorHandler?
optionalerrorHandler?:string|string[]
Path(s) to custom runtime error handler(s).
Custom handlers run before the built-in error handler, which is always added as a fallback.
See
https://nitro.build/config#errorhandler
Inherited from
Omit.errorHandler
experimental?
optionalexperimental?:object&object
Experimental feature flags.
These features are not yet stable and may change in future releases.
Type Declaration
asyncContext?
optionalasyncContext?:boolean
Enable native async context support for useRequest()
database?
optionaldatabase?:boolean
Enable experimental Database support
See
https://nitro.build/docs/database
envExpansion?
optionalenvExpansion?:boolean
Allow env expansion in runtime config
See
https://github.com/nitrojs/nitro/pull/2043
openAPI?
optionalopenAPI?:boolean
Enable experimental OpenAPI support
See
https://nitro.build/docs/openapi
sourcemapMinify?
optionalsourcemapMinify?:false
Set to false to disable sourcemap minification in production builds.
Sourcemap minification is enabled by default when sourcemap is on.
tasks?
optionaltasks?:boolean
Enable experimental Tasks support
See
https://nitro.build/docs/tasks
typescriptBundlerResolution?
optionaltypescriptBundlerResolution?:boolean
See https://github.com/microsoft/TypeScript/pull/51669
websocket?
optionalwebsocket?:boolean
Enable WebSocket upgrade support
Deprecated
Use features.websocket instead.
Type Declaration
vite?
optionalvite?:object
vite.assetsImport?
optionalassetsImport?:boolean
Experimental
Enable ?assets import proposed by https://github.com/vitejs/vite/discussions/20913
Default
truevite.serverReload?
optionalserverReload?:boolean
Invalidate server-only modules and optionally reload the browser when a server-only module is updated.
Default
truevite.services?
optionalservices?:Record<string,ServiceConfig>
Additional Vite environment services to register.
See
https://nitro.build/config#experimental
Inherited from
Omit.experimental
exportConditions?
optionalexportConditions?:string[]
Custom export conditions for module resolution.
See
https://nitro.build/config#exportconditions
Inherited from
Omit.exportConditions
extends?
optionalextends?:string|string[] |NitroPreset
Inherited from
Omit.extends
features?
optionalfeatures?:object
Built-in feature flags.
runtimeHooks?
optionalruntimeHooks?:boolean
Enable runtime hooks for request and response.
By default this feature will be enabled if there is at least one nitro plugin.
websocket?
optionalwebsocket?:boolean
Enable WebSocket support.
See
https://nitro.build/config#features
Inherited from
Omit.features
firebase?
optionalfirebase?:FirebaseOptions
Inherited from
Omit.firebase
framework?
optionalframework?:NitroFrameworkInfo
Metadata about the higher-level framework using Nitro (e.g. Nuxt).
Used by presets and included in build info output.
See
https://nitro.build/config#framework
Inherited from
Omit.framework
future?
optionalfuture?:object
Future features pending a major version to avoid breaking changes.
nativeSWR?
optionalnativeSWR?:boolean
Opt in to Nitro's native isr route rule handling on Vercel and suppress backwards-compatibility warnings for legacy swr/static route options.
See
https://nitro.build/config#future
Inherited from
Omit.future
handlers?
optionalhandlers?:NitroEventHandler[]
Server handler registrations.
Handlers in routes/, api/, and middleware/ directories are auto-registered when serverDir is set.
See
Inherited from
Omit.handlers
hooks?
optionalhooks?:NestedHooks<NitroHooks>
Nitro lifecycle hooks.
See
Inherited from
Omit.hooks
ignore?
optionalignore?:string[]
Glob patterns to ignore when scanning directories.
See
https://nitro.build/config#ignore
Inherited from
Omit.ignore
iis?
optionaliis?:object
IIS-specific deployment options.
mergeConfig?
optionalmergeConfig?:boolean
Merge with existing IIS web.config instead of replacing.
overrideConfig?
optionaloverrideConfig?:boolean
Inherited from
Omit.iis
imports?
optionalimports?:false|Partial<UnimportPluginOptions>
Auto-import configuration.
Set to false to disable auto-imports. Pass an object to customize.
Default
falseSee
Inherited from
Omit.imports
inlineDynamicImports?
optionalinlineDynamicImports?:boolean
Bundle all code into a single file instead of separate chunks.
When false, each route handler becomes a separate chunk loaded on-demand. Some presets enable this by default.
See
https://nitro.build/config#inlinedynamicimports
Inherited from
Omit.inlineDynamicImports
logging?
optionallogging?:object
Build logging behavior.
buildSuccess?
optionalbuildSuccess?:boolean
compressedSizes?
optionalcompressedSizes?:boolean
Report compressed bundle sizes after build.
See
https://nitro.build/config#logging
Inherited from
Omit.logging
logLevel?
optionallogLevel?:LogLevel
Log verbosity level.
Defaults to 3, or 1 when a testing environment is detected.
See
Inherited from
Omit.logLevel
manifest?
optionalmanifest?:object
Build manifest options.
deploymentId?
optionaldeploymentId?:string
Custom deployment identifier included in the build manifest.
Inherited from
Omit.manifest
minify?
optionalminify?:boolean
Minify the production bundle.
See
https://nitro.build/config#minify
Inherited from
Omit.minify
modules?
optionalmodules?:NitroModuleInput[]
Nitro modules to extend behavior during initialization.
Accepts module path strings, NitroModule objects, or bare setup functions.
See
https://nitro.build/config#modules
Inherited from
Omit.modules
netlify?
optionalnetlify?:NetlifyOptions
Inherited from
Omit.netlify
node?
optionalnode?:boolean
Target a Node.js-compatible runtime.
When true (default), the bundler targets the node platform, prefers Node.js built-in modules, and enables dependency externalization.
When false, Nitro prepends the nodeless unenv preset to polyfill Node.js globals and built-ins for non-Node runtimes (workers, edge, Deno).
See
https://nitro.build/config#node
Inherited from
Omit.node
noExternals?
optionalnoExternals?:boolean| (string|RegExp)[]
Prevent packages from being externalized.
Set to true to bundle all dependencies, or pass an array of package names or patterns.
See
https://nitro.build/config#noexternals
Inherited from
Omit.noExternals
noPublicDir?
optionalnoPublicDir?:boolean
Disable the public output directory entirely.
Skips preparing the .output/public directory, copying public assets, and prerendering routes.
See
https://nitro.build/config#nopublicdir
Inherited from
Omit.noPublicDir
openAPI?
optionalopenAPI?:NitroOpenAPIConfig
OpenAPI specification generation and UI configuration.
See
Inherited from
Omit.openAPI
output?
optionaloutput?:Partial<{dir:string;publicDir:string;serverDir:string; }>
Inherited from
Omit.output
oxc?
optionaloxc?:OXCOptions
OXC options for Rolldown builds (minification and transforms).
See
https://nitro.build/config#oxc
Inherited from
Omit.oxc
plugins?
optionalplugins?:string[]
Paths to Nitro runtime plugins.
Plugins in the plugins/ directory are auto-registered.
See
Inherited from
Omit.plugins
prerender?
optionalprerender?:object
Prerendering options.
Routes specified here are fetched during the build and copied to .output/public as static assets.
autoSubfolderIndex?
optionalautoSubfolderIndex?:boolean
Prerender HTML routes within subfolders (/test produces /test/index.html).
concurrency?
optionalconcurrency?:number
crawlLinks?
optionalcrawlLinks?:boolean
failOnError?
optionalfailOnError?:boolean
ignore?
optionalignore?: (string|RegExp| ((path) =>boolean|null|undefined))[]
ignoreUnprefixedPublicAssets?
optionalignoreUnprefixedPublicAssets?:boolean
interval?
optionalinterval?:number
retry?
optionalretry?:number
Amount of retries. Pass Infinity to retry indefinitely.
Default
3retryDelay?
optionalretryDelay?:number
Delay between each retry in ms.
Default
500routes?
optionalroutes?:string[]
See
https://nitro.build/config#prerender
Inherited from
Omit.prerender
preset?
optionalpreset?:PresetNameInput
Inherited from
Omit.preset
publicAssets?
optionalpublicAssets?:PublicAssetDir[]
Public asset directories served in development and bundled in production.
A public/ directory is added by default when detected.
See
Inherited from
Omit.publicAssets
renderer?
optionalrenderer?:false| {handler?:string;static?:boolean;template?:string; }
Inherited from
Omit.renderer
replace?
optionalreplace?:Record<string,string| ((id) =>string)>
Build-time string replacements.
See
https://nitro.build/config#replace
Inherited from
Omit.replace
rolldownConfig?
optionalrolldownConfig?:RolldownConfig
Additional Rolldown configuration.
See
https://nitro.build/config#rolldownconfig
Inherited from
Omit.rolldownConfig
rollupConfig?
optionalrollupConfig?:Partial<RollupConfig>
Inherited from
Omit.rollupConfig
rootDir?
optionalrootDir?:string
Project main root directory.
See
https://nitro.build/config#rootdir
Inherited from
Omit.rootDir
routeRules?
optionalrouteRules?:object
Index Signature
[path: string]: NitroRouteConfig
Inherited from
Omit.routeRules
routes?
optionalroutes?:Record<string,string|Omit<NitroEventHandler,"route"|"middleware">>
Inline route definitions.
A map from route pattern to handler path or handler options.
See
https://nitro.build/config#routes
Inherited from
Omit.routes
routesDir?
optionalroutesDir?:string
Directory name to scan for route handlers.
Default
"routes"See
https://nitro.build/config#routesdir
Inherited from
Omit.routesDir
runtimeConfig?
optionalruntimeConfig?:NitroRuntimeConfig
Server runtime configuration accessible via useRuntimeConfig().
Values can be overridden at runtime using environment variables with the NITRO_ prefix. An alternative prefix can be configured via runtimeConfig.nitro.envPrefix or NITRO_ENV_PREFIX.
Note: The nitro namespace is reserved for internal use.
Example
runtimeConfig: {
apiSecret: "default-secret", // override with NITRO_API_SECRET
}See
https://nitro.build/config#runtimeconfig
Inherited from
Omit.runtimeConfig
scanDirs?
optionalscanDirs?:string[]
Additional directories to scan and auto-register files such as API route handlers.
See
https://nitro.build/config#scandirs
Inherited from
Omit.scanDirs
scheduledTasks?
optionalscheduledTasks?:object
Map of cron expressions to task name(s).
Index Signature
[cron: string]: string | string[]
Example
scheduledTasks: {
"0 * * * *": "cleanup:temp",
"*/5 * * * *": ["health:check", "metrics:collect"],
}See
Inherited from
Omit.scheduledTasks
serverAssets?
optionalserverAssets?:ServerAssetDir[]
Server-side asset directories bundled at build time.
See
Inherited from
Omit.serverAssets
serverDir?
optionalserverDir?:string&object|"./server"|"./"
serverEntry?
optionalserverEntry?:string|false| {format?:EventHandlerFormat;handler:string; }
Inherited from
Omit.serverEntry
serveStatic?
optionalserveStatic?:boolean|"node"|"deno"|"inline"
Include a static asset handler in the server bundle to serve public assets.
trueor"node"— read assets from the filesystem using Node.jsfs."deno"— read assets using Deno file APIs."inline"— base64-encode assets directly into the server bundle.false— do not serve static assets from the server (rely on a CDN or reverse proxy).
Most self-hosted presets (e.g. node-server, bun) enable this by default.
See
https://nitro.build/config#servestatic
Inherited from
Omit.serveStatic
sourcemap?
optionalsourcemap?:boolean
Enable source map generation.
See
https://nitro.build/config#sourcemap
Inherited from
Omit.sourcemap
srcDir?
optionalsrcDir?:string
Deprecated
Migrate to serverDir.
Inherited from
Omit.srcDir
ssrRoutes?
optionalssrRoutes?:string[]
Routes that should be server-side rendered.
Inherited from
Omit.ssrRoutes
static?
optionalstatic?:boolean
Disable the server build and only output prerendered static assets.
When true, the server bundle is skipped entirely and only the public directory is produced. Typically used by the static preset and its derivatives (e.g., github-pages, vercel-static).
Note: This does not enable prerendering on its own — configure prerender options separately.
See
https://nitro.build/config#static
Inherited from
Omit.static
storage?
optionalstorage?:StorageMounts
Storage mount configuration.
Keys are mount-point paths; values specify the unstorage driver and its options.
See
Inherited from
Omit.storage
tasks?
optionaltasks?:object
Task definitions.
Each key is a task name with a handler path and optional description.
Index Signature
[name: string]: object
Example
tasks: {
"db:migrate": {
handler: "./tasks/db-migrate",
description: "Run database migrations",
},
}See
Inherited from
Omit.tasks
traceDeps?
optionaltraceDeps?: (string|RegExp)[]
Additional dependencies to trace and include in the build output.
Supports !pkg to exclude and pkg* for full package trace.
See
https://nitro.build/config#tracedeps
Inherited from
Omit.traceDeps
traceOpts?
optionaltraceOpts?:Pick<ExternalsTraceOptions,"hooks"|"transform"|"nft"|"traceAlias"|"chmod">
Advanced options for dependency tracing via nf3.
See
Inherited from
Omit.traceOpts
tracingChannel?
optionaltracingChannel?:boolean|TracingOptions
Inherited from
Omit.tracingChannel
typescript?
optionaltypescript?:object
TypeScript configuration options.
generatedTypesDir?
optionalgeneratedTypesDir?:string
Path of the generated types directory.
Default
"node_modules/.nitro/types"generateRuntimeConfigTypes?
optionalgenerateRuntimeConfigTypes?:boolean
generateTsConfig?
optionalgenerateTsConfig?:boolean
strict?
optionalstrict?:boolean
Enable strict TypeScript checks.
tsConfig?
optionaltsConfig?:Partial<TSConfig>
tsconfigPath?
optionaltsconfigPath?:string
Path of the generated tsconfig.json relative to typescript.generatedTypesDir.
Default
"tsconfig.json"See
https://nitro.build/config#typescript
Inherited from
Omit.typescript
unenv?
optionalunenv?:Preset|Preset[]
Inherited from
Omit.unenv
vercel?
optionalvercel?:VercelOptions
Inherited from
Omit.vercel
virtual?
optionalvirtual?:Record<string,string| (() =>string|Promise<string>)>
Virtual module definitions.
A map from dynamic virtual import names to their contents or an async function that returns them.
See
https://nitro.build/config#virtual
Inherited from
Omit.virtual
wasm?
optionalwasm?:false|UnwasmPluginOptions
Native wasm compatibility/bundling support configuration.
Set to false to disable.
See
Inherited from
Omit.wasm
watchOptions?
optionalwatchOptions?:Partial<BasicOpts&object>
File watcher options for development mode.
See
Inherited from
Omit.watchOptions
workspaceDir?
optionalworkspaceDir?:string
Project workspace root directory.
Auto-detected from the workspace (e.g. pnpm workspace) when not set.
See
https://nitro.build/config#workspacedir
Inherited from
Omit.workspaceDir
zephyr?
optionalzephyr?:ZephyrOptions
Inherited from
Omit.zephyr