Build Servers
Nitro builds production-ready servers that run anywhere.
Write API routes, then deploy the same codebase to Node.js, Bun, Deno, or serverless, with zero configuration.
Routing
Files in, Routes out
routes/ and it becomes a route. Append the HTTP method to the filename to scope it, nest folders for path params, and wrap a folder in parentheses to group routes without touching the URL.- Routes are compiled no runtime router ships in the bundle
- Dynamic params, wildcards and per-method files
- Route groups organize files without changing URLs
- hello.get.tsGET/hello
- hello.post.tsPOST/hello
- api/test.tsANY/api/test
- api/[org]/[repo].tsANY/api/:org/:repo
- (admin)/users.tsANY/users
Server entry
Bring your own framework
fetch(request): Response interface can be your server entry export it from server.ts and it runs for every request before routes are matched. Node-style (req, res) frameworks work too: name the file server.node.ts and Nitro adapts it.import { H3 } from "h3";
const app = new H3();
app.get("/", () => "⚡️ Hello from H3!");
export default app;Deploy
One codebase, every platform
- Providers are auto-detected in CI no adapter to install
- Switch targets with a single `preset` option
- Compatibility dates keep provider behavior stable over time
Output
Small enough to read
Cache
Caching that follows your storage
- Stale-while-revalidate responses by default
- ETag, last-modified and 304 handling out of the box
- Concurrent requests for one key share a single invocation
import { defineCachedHandler } from "nitro/cache";
export default defineCachedHandler(
async () => {
const res = await fetch("https://api.github.com/repos/nitrojs/nitro");
const { stargazers_count } = await res.json();
return { stars: stargazers_count };
},
{ maxAge: 60 * 60 }
);Included
Everything a server needs
The pieces most apps reach for ship with Nitro, and every one of them behaves the same on every deployment target.
KV Storage
One key-value API over the filesystem, Redis, Cloudflare KV and more.
Database
ExperimentalSQL layer powered by db0, preconfigured with SQLite.
Tasks
ExperimentalOne-off runtime operations, run from the CLI or on a cron schedule.
WebSockets
Cross-runtime WebSocket support built on crossws.
Plugins
Hook into the server lifecycle from the plugins/ directory.
OpenAPI
ExperimentalA spec generated from your handlers, served through Scalar or Swagger UI.
Assets
Public files served directly, server assets readable at runtime.
Renderer
A catch-all handler for unmatched routes SSR, SPA shells or plain HTML.
Lifecycle
Every layer a request passes through, in order, and where to intercept it.
Start with one command
npx create-nitro-app