Nitro logoNitro

Examples

Explore Nitro examples to learn how to build full-stack applications with different frameworks and features.
Work in Progress
Nitro v3 Alpha docs and examples are a work in progress — expect updates, rough edges, and occasional inaccuracies.

Features

API Routes
File-based API routing with HTTP method support and dynamic parameters.
Cached Handler
Cache route responses with configurable bypass logic.
Custom Error Handler
Customize error responses with a global error handler.
Database
Built-in database support with SQL template literals.
Hello World
Minimal Nitro server using the web standard fetch handler.
Middleware
Request middleware for authentication, logging, and request modification.
Plugins
Extend Nitro with custom plugins for hooks and lifecycle events.
Server Fetch
Internal server-to-server requests without network overhead.
Virtual Routes
Define routes programmatically using Nitro's virtual module system.
WebSocket
Real-time bidirectional communication with WebSocket support.

Config

Auto Imports
Automatic imports for utilities and composables.
Import Alias
Custom import aliases for cleaner module paths.
Runtime Config
Environment-aware configuration with runtime access.

Server side rendering

Mono JSX
Server-side JSX rendering in Nitro with mono-jsx.
Nano JSX
Server-side JSX rendering in Nitro with nano-jsx.
Custom Renderer
Build a custom HTML renderer in Nitro with server-side data fetching.
Vite SSR HTML
Server-side rendering with vanilla HTML, Vite, and Nitro.
SSR with Preact
Server-side rendering with Preact in Nitro using Vite.
SSR with React
Server-side rendering with React in Nitro using Vite.
SSR with SolidJS
Server-side rendering with SolidJS in Nitro using Vite.
SSR with TanStack Router
Client-side routing with TanStack Router in Nitro using Vite.
SSR with TanStack Start
Full-stack React with TanStack Start in Nitro using Vite.
SSR with Vue Router
Server-side rendering with Vue Router in Nitro using Vite.

Backend frameworks

Elysia
Integrate Elysia with Nitro using the server entry.
Express
Integrate Express with Nitro using the server entry.
Fastify
Integrate Fastify with Nitro using the server entry.
Hono
Integrate Hono with Nitro using the server entry.

Integrations

Shiki
Server-side syntax highlighting in Nitro with Shiki.

Vite

Vite Nitro Plugin
Use Nitro as a Vite plugin for programmatic configuration.
Vite RSC
React Server Components with Vite and Nitro.
Vite + tRPC
End-to-end typesafe APIs with tRPC in Nitro using Vite.