Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 53 additions & 9 deletions docs/1.docs/1.index.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,68 @@ icon: i-lucide-compass

# Introduction

> Nitro is a full-stack framework, compatible with any runtime. It extends your Vite application with a production-ready server.
> Welcome to Nitro: Progressive, Compatible, and Production-Ready.

Vite’s main purpose is to build frontend applications. It provides a fast dev server to transform and serve resources with HMR, but it doesn’t include a production server.
Nitro is a full-stack framework that can run as a standalone backend server or extend your Vite application with a production-ready server.

When creating an SPA, you often need to add API routesβ€”whether to bypass CORS, call services with an API token, or implement your own backend logic. Nitro lets you create server and API routes inside the `routes/` directory of your project. You can even go further and take control of the entire server entry by creating a `server.ts` file. With its high-level and runtime-agnostic approach, Nitro allows you to use any HTTP library, such as [Elysia](https://elysiajs.com/), [h3](https://h3.dev) or [Hono](https://hono.dev).
## Extend your Vite application with...

But that’s not all: running `vite build` also builds both your backend and frontend code into an optimized `.output/` folder. This output is compatible not only with Node.js, Bun, and Deno, but also with many hosting platforms without any configuration. This means you can deploy your full-stack Vite application to Cloudflare Workers, Netlify, Vercel, and more, without changing a single line of code, while taking advantage of platform features like ESR, ISR, and SWR.
### Production-ready server

The Nitro server is highly performant. By combining code-splitting with compiled routes, it removes the need for a runtime router, leaving only minimal compiled logic. This makes it ideal for serverless hosting, since boot-up time is nearly 0ms regardless of project size and only the code required to handle the incoming request is loaded and executed.
As a bundler, Vite's main purpose is to build frontend applications. So it only provides a fast dev server to transform and serve resources with HMR.

Having a server also unlocks server-side rendering. You can render HTML with your favorite templating engine, or use component libraries such as React, Vue, or Svelte directly on the server. You can even go full universal rendering with client-side hydration. Nitro provides the foundation and a progressive approach to reach your goals.
By extending your Vite application with Nitro, you can easily have a production-ready server. Running `vite build` builds both your backend and frontend code into an optimized `.output/` folder.

Server data storage is often needed, and Nitro includes a runtime-agnostic key-value storage layer out of the box. It uses in-memory storage by default, but you can connect more than 20 different drivers (FS, Redis, S3, etc.), attach them to different namespaces, and swap them without changing your code.
### API Routes

When creating an SPA, you often need to add API routesβ€”whether to bypass CORS, call services with an API token, or implement your own backend logic.

Nitro lets you create server and API routes inside the `routes/` directory of your project.

### Server-Side Rendering

Having a server also unlocks server-side rendering. You can render HTML with your favorite templating engine, or use component libraries such as React, Vue, or Svelte directly on the server. You can even go full universal rendering with client-side hydration.

Nitro provides the foundation and a progressive approach to reach your goals.

## Deploy to anywhere

Nitro has excellent cross-platform compatibility. Its output is compatible not only with Node.js, Bun, and Deno, but also with many hosting platforms without any configuration.

This means you can deploy your application to Cloudflare Workers, Netlify, Vercel, and more, without changing a single line of code, while taking advantage of platform features like ESR, ISR, and SWR.

## Integrate with other frameworks

You can go further and take control of the entire server entry by creating a `server.ts` file. With its high-level and runtime-agnostic approach, Nitro allows you to use any HTTP library, such as [Elysia](https://elysiajs.com/), [Express](https://expressjs.com/), [h3](https://h3.dev/) or [Hono](https://hono.dev/).

## Optimal Performance

By combining code-splitting with compiled routes, Nitro removes the need for a runtime router, leaving only minimal compiled logic.

This makes it ideal for serverless hosting, since boot-up time is nearly 0ms regardless of project size and only the code required to handle the incoming request is loaded and executed.

## Built-in functions

### KV Storage

Server data storage is often needed, and Nitro includes a runtime-agnostic key-value storage layer out of the box.

It uses in-memory storage by default. You can connect more than 20 different drivers (FS, Redis, S3, etc.), attach them to different namespaces, and swap them without changing your code.

### Cache

Caching is a key part of any web server, which is why Nitro supports caching for both server routes and server functions, backed directly by the server storage (via the `cache` namespace).

When key-value storage isn’t enough, Nitro also includes a built-in SQL database. It defaults to SQLite, but you can connect to and query more than 10 databases (Postgres, MySQL, PGLite, etc.) using the same API.
### SQL Database

When key-value storage isn' t enough, Nitro also includes a built-in SQL database.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟑 Minor

Fix typo in user-facing text.

β€œisn' t” has an extra space. Please correct to β€œisn't”.

✏️ Proposed fix
-When key-value storage isn' t enough, Nitro also includes a built-in SQL database.
+When key-value storage isn't enough, Nitro also includes a built-in SQL database.
πŸ“ Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
When key-value storage isn' t enough, Nitro also includes a built-in SQL database.
When key-value storage isn't enough, Nitro also includes a built-in SQL database.
πŸ€– Prompt for AI Agents
In `@docs/1.docs/1.index.md` at line 61, Fix the typo in the user-facing sentence
in docs/1.docs/1.index.md by replacing "isn' t" with the correct contraction
"isn't" in the line that reads "When key-value storage isn' t enough, Nitro also
includes a built-in SQL database." Ensure the updated text reads exactly "When
key-value storage isn't enough, Nitro also includes a built-in SQL database."


It defaults to SQLite and allows you to connect to and query more than 10 databases (Postgres, MySQL, PGLite, etc.) using the same API.

## Build your meta-framework with Nitro

Nitro can be used as the foundation for building a meta-framework. Popular frameworks such as Nuxt, SolidStart and TanStack Start fully or partially leverage Nitro.

Last but not least, Nitro can be used as the foundation for building your own meta-framework. Popular frameworks such as Nuxt, SolidStart and TanStack Start fully or partially leverage Nitro.
## Try it now

Ready to give it a try? Jump into the [quick start](/docs/quick-start).
Loading