Nitro is the server engine behind Nuxt, Analog, and Vinxi. It compiles your server-side code to run anywhere: Node, Deno, Bun, Cloudflare Workers, Vercel, Netlify, AWS Lambda — from one codebase.
Quick Start
npx giget@latest nitro my-app
cd my-app && npm install && npm run dev
API Routes
// routes/api/hello.ts
export default defineEventHandler((event) => {
return { hello: 'world' }
})
// routes/api/users/[id].ts
export default defineEventHandler((event) => {
const id = getRouterParam(event, 'id')
return { userId: id }
})
Deploy Anywhere
# Build for different platforms
NITRO_PRESET=vercel npx nitropack build
NITRO_PRESET=cloudflare npx nitropack build
NITRO_PRESET=netlify npx nitropack build
NITRO_PRESET=node-server npx nitropack build
NITRO_PRESET=deno-server npx nitropack build
NITRO_PRESET=bun npx nitropack build
Same code, different deployment target. Change one env var.
Key Features
- Auto-imports: No import statements needed for utilities
-
File-based routing:
/routes/api/users.ts->/api/users - Storage: Unified storage API (Redis, S3, filesystem)
-
Caching: Built-in route caching with
defineCachedEventHandler - WebSocket: Native WebSocket support
- Tasks: Background task scheduling
Caching
export default defineCachedEventHandler(async (event) => {
const data = await fetchExpensiveData()
return data
}, { maxAge: 60 * 60 }) // cache for 1 hour
Storage API
export default defineEventHandler(async (event) => {
// Works with Redis, S3, filesystem — same API
await useStorage().setItem('key', { value: 42 })
const data = await useStorage().getItem('key')
return data
})
The Bottom Line
Nitro is the universal server engine for JavaScript. Write once, deploy to 15+ platforms. If you're building server-side JS and want maximum deployment flexibility, Nitro is the foundation.
Need to automate data collection or build custom scrapers? Check out my Apify actors for ready-made tools, or email spinov001@gmail.com for custom solutions.
Top comments (0)