nitropack
2.13.6 · 2 Nov 2026MIT3.9M / weekRepositoryHomepagenpmAtom feed
2.13.6 is the newest release of 2.x.
In short
29 new30 fixed9 changed42 internal
Security
2 advisories affect 2.10.0; 2.13.4 fixes them
- ModerateNitro has an Open Redirect via Protocol-Relative URL Bypass in Wildcard Route RulesGHSA-9phm-9p8f-hw5m · 6 May 2026Fixed in 2.13.4
- ModerateNitro has a proxy scope bypass via percent-encoded path traversal in `routeRules`GHSA-5w89-w975-hf9q · 6 May 2026Fixed in 2.13.4
Release note
New home
After almost 4 years of Nitro development, it's time to evolve Nitro into a larger community and ecosystem.
Current nitro-related repositories have been moved under the nitrojs Github org.
Nitro documentation is hosted under a new shorter domain name: nitro.build.
nitropacknpm package is in transition to becomenitro.
We have created a new community. You can follow Nitro updates on X via @nitrojsdev and on Bluesky via @nitro.build and feel free to join our new Discord server if you like to be involved ❤️.
Major internal overhaul
We have made several (non-breaking) refactors in the Nitro codebase to improve long-term maintenance and structure consistency with the upcoming Nitro v3 releases.
Nitro 2.10 is a cumulative update with over 245 commits, 400+ changed files, 22,018 additions, and 13,207 deletions from 65 contributors, preparing for the next steps toward the Nitro 3 release. (see all changes)
src/* structure is more modular (#2473), all logic related to presets moved to src/presets/* (#2446) and internal type checks are more stricter (#2370, #2529).
Important
If you previously imported any utility from #internal/nitro/* or nitropack/runtime/* you should change them to #imports to avoid issues.
Compatibility date
Deployment providers introduce new features that Nitro presets can leverage, but some of them need to be explicitly opted into.
Nitro introduces a new compatibilityDate configuration (#2511) that allows leveraging the latest platform enhancements. The Cloudflare and Netlify presets now use this feature. If this configuration is not provided, Nitro will continue using the current (v2.9) behavior for presets.
Migration:
export default defineNitroConfig({
+++ compatibilityDate: "2024-11-01",
});Environment-specific handlers
Each route handler in server/routes/* and server/api/* is always included in the server bundle for development, prerender, and production.
With the new environment-specific event handlers (#2272), you can now specify handlers that are included only under certain conditions:
.dev(e.g.,server/api/inspect.dev.ts): Included only in development mode..prerender(e.g.,server/api/og_image.prerender.ts): Included only in the prerendering stage..prod(e.g.,server/api/health.prod.ts): Included only in the production bundle.
This feature allows for conventionally having multiple versions of handlers (e.g., routes/admin.dev.ts + routes/admin.prod.ts).
Additionally, if you add route handlers programmatically (via the handlers: Nitro config), you can use the env key to specify preset-specific filters.
Route groups
You can use (...)/ directory names inside server/api/* and server/routes/* to logically group handlers without dir being part of the path (#2664).
For example, having server/api/(group)/test.ts, will add a /api/test route.
production mode OpenAPI support
The experimental OpenAPI feature can now be enabled in production mode (#2570).
To enable it, set openAPI.production in the Nitro configuration.
export default defineNitroConfig({
experimental: {
openAPI: true,
},
openAPI: {
// IMPORTANT: make sure to protect OpenAPI routes if necessary!
production: "runtime", // or 'prerender'
},
});New OpenAPI routes:
/_openapi.json: OpenAPI v2 JSON to be used in external tools/_swagger: built-in Swagger UI/_scalar: built-in Scalar UI
Upgraded dependencies
Experimental WebSocket support is better with crossws@0.3 upgrade.
Experimental Database support is better with db0@0.2 upgrade.
Typescript support for
nitro.config.tsand nitro modules is better with jiti@2.0.
Preset updates
Cloudflare
cloudflare-module preset, with compatibilityDate config set to 2024-09-19 or later, leverages new Static Assets support to allow serving static assets directly from cloudflare CDN with low latency and without hitting the worker and occurring costs (#2800) (Note: Please beware of current limitations while this feature is in Beta).
A new (experimental) cloudflare-durable preset is available which extends coudflare-module to allow leveraging Cloudflare Durable objects(#2801). This allows using WebSockets with pub/sub support for use cases like chat rooms or live collaboration (check out nuxt-tiptap for a demo).
Nitro 2.10 added several hooks such as cloudflare:email and cloudflare:queue (#2487) and cloudflare:scheduled, cloudflare:email, cloudflare:queue, cloudflare:tail and cloudflare:trace for cloudflare-module preset (#2795) usable with plugins.
With the cloudflare-pages preset, if cloudflare: { wrangler: { ... } } is set in nitro config, Nitro will automatically merge it with wrangler.toml in your project root during build.
Netlify
netlify preset uses Netlify Functions 2.0 format when compatibilityDate is set to 2024-05-07 or later (#2406). This allows streaming responses (demo), better support for hybrid rendering (prerender: true route rule works as intended), improves background request generation, fixing bugs with set-cookie: undefined on responses and Netlify Blobs will now work out of the box.
Previously, ISR in Nitro had been implemented on Netlify via proprietary On-Demand Builders platform primitive, which only supported "v1" Functions. Now that there's momentum around Targeted HTTP Cache Control and that Netlify supports it, we can implement ISR in Nitro via these simple, standard HTTP headers instead. With the isr route rule, the new preset uses a new durable cache-control directive (#2571).
All netlify presets now leverage from better static asset handling to avoid extra function invocations and saving costs (#2822, #2823).
Vercel
When using isr route rule, by default, query paramas are ignored by cache. Now, you can pass an options object to isr: {} route rule to configure caching behavior (#2780). Read more in docs.
AWS Lambda
We have experimented streaming support for aws-lambda (#2412) and added it as an opt-in flag to enable streaming in supported deployments using awsLambda: { streaming: true } nitro config (#2786).
New presets
We have added support for genezio (#2637) and zerops (#2698) deployment providers.
Other changes
Enhancements
Generate types for runtime config
Support
ignoreoption for server assetsExpose
getRouteRulesForPathfrom nitro runtimeopenapi: Support configuration via
openapiEnvironment specific event handlers
Experimental
defineRouteMetaAllow customizing
apiBaseURL,apiDirandroutesDirAdd
gitlab-pagesstatic providerCompatibility date support
config: Warn if the runtime config is not serializable
open-api: Production mode support
deno-server: Use output
node_modulesforstarttaskdev-server: Redirect requests without base URL
firebase: Upgrade default runtime to node 20
Add
.sqlto the default raw file extensionsRoute groups support
renderer: Add
render:beforehookAdd
.pdfand.wasmto compressible mime typesInclude preset config in
.output/nitro.jsonLimit open files in
generateFSTreenetlify-legacy: Exclude static paths from server handler
netlify, netlify-edge: Exclude static paths from server handler
cache: Set
ttlfor native expiration (with SWR disabled)
Fixes
deno-server: Always inject
processfromnode:processexternals: Compare package paths against normalized
idazure: Correctly handle
maxAgecookie optionAvoid named exports from
package.jsonMore compatibility for import from
nitropack/runtime/*build: Correctly watch custom
apiDirandroutesDirMake sure nitro runtime goes to one chunk
Backward compatibility types for v2
handler-meta: Check for
.namewithundefinedvalue inObjectExpressionHide unhandled error messages in prod
prerender: Allow ignoring errors in
prerender:generatehookOnly hide messages of unhandled errors in prod
prerender: Skip protocol relative links
Ensure legacy runtime config types are populated
Ensure legacy hook types are populated
Do not generate runtime config types with an external framework
prerender: Log error stack traces
cache: Use top-level
functionto avoid rollup chunk ordering issuescli: Respect custom
buildDiroption fortaskssubcommandInitialize nitro app before plugins run
cloudflare-module: Use correct types for email and queue events/hooks
azure-functions: Follow symlinks in zip bundle
firebase: Validate custom
serverFunctionNameAdd
db0andstd-envtoruntimeDependencieserror: Add
cache-control: no-cachefor 404 responsesrenderer: Check
ctx.responsecf-pages: Only create
wrangler.tomlif the config is not emptynetlify: Added missing quotes in utils
netlify: Match ISR route rules when path has a query string
cache: Try decode path
cloudflare: Support custom
baseURLHandle incompatible compatibility date for presets
A whole project to check? Paste its package.json in the dependency check: every deprecated, outdated or vulnerable dependency, with what to upgrade to. Free, no account.