Ship Full-Stack Vite Apps
Nitro extends your Vite application with a production-ready server, compatible with any runtime. Add server routes to your application and deploy many hosting platform with a zero-config experience.
import { defineConfig } from 'vite' import { nitro } from 'nitro/vite' export default defineConfig({ plugins: [ nitro() ], nitro: { preset: 'standard' } })
Fast
Enjoy the Vite development experience with HMR on the server and optimized for production.
Versatile
Deploy the same codebase to any deployment provider with zero config, no vendor lock-in.
Minimal
Minimal design to fit into any solution with minimum overhead.
Create Server Routes
Start creating API routes in the routes/ folder or start with your favorite backend framework in a server.ts
file.
- routes/Create server routes in the routes/ folder and they will be automatically registered.
- server.tsGo full Web standard and pick standard library of your choice to create server routes using the server.ts file.
routes/hello.ts
import { defineHandler } from 'nitro/h3' export default defineHandler(({ req }) => { return { api: 'works!' } })
server.ts
export default { async fetch(req: Request): Promise<Response> { return new Response(`Hello world! (${req.url})`); }, };
server.ts
import { H3 } from 'h3' const app = new H3() app.get("/", () => '⚡️ Hello from H3!') export default app
server.ts
import { Hono } from 'hono' const app = new Hono() app.get("/", (c) => c.text('🔥 Hello from Hono!')) export default app
server.ts
import { Elysia } from 'elysia' const app = new Elysia() app.get("/", (c) => '🦊 Hello from Elysia!') export default app