Nitro is a powerful framework for building universal JavaScript servers, enabling developers to write code once and deploy it across various environments including Node.js, serverless platforms, and edge functions. The current stable version is v2.13.3, which is maintained with regular dependency updates and critical security fixes. Active development is focused on the upcoming v3 beta, which promises further performance enhancements and features. Key differentiators include its "run anywhere" philosophy, exceptional runtime performance (approaching native levels on platforms like Bun), and a minimal install footprint. It integrates deeply with ecosystem tools like Nuxt and provides advanced features such as experimental tracing channels and smarter dependency tracing, ensuring timely updates and security patches.
npm install nitropackVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to configure Nitro, define a basic API route using `defineEventHandler`, and access runtime configuration using `useRuntimeConfig`.
For new projects, consider starting with Nitro v3 beta if compatible with your ecosystem. For existing v2 projects, thoroughly review v3 migration guides before upgrading.
To access the latest features and performance improvements, check out the `v3` branch on GitHub and follow its development. Be aware that v3 is pre-release software.
Upgrade to `nitropack@2.13.2` or later immediately to incorporate these crucial security patches.
Ensure `xml2js` is installed in your project: `npm install xml2js` or `pnpm add xml2js` if you encounter issues related to XML processing.
Ensure you have a `nitro.config.ts` (or `.js`) file in your project's root directory. If it exists, verify its contents and path, and ensure your build command is run from the correct directory.
Ensure you are using `import { defineEventHandler } from 'nitropack'` in your server files, and that your project is configured for ESM (e.g., `"type": "module"` in `package.json`).Add `import { useRuntimeConfig } from 'nitropack'` to the top of your file. Ensure you are calling this function within a server handler or plugin where the Nitro context is initialized.