Getting Started

Create web servers with all necessary features and deploy them wherever you prefer.

Intro

Nitro is an open source framework to build web servers using unjs/h3 and lots of built-in features. Nitro automatically makes your code compatible with any deployment provider and runtime!

Nitro can be used standalone or as the server engine of full-stack frameworks such as Nuxt.

Quick start

Instead of setting up a local development environment, you can use the online playground.
Make sure you have installed the recommended setup:

Create a new project using starter template:

npx giget@latest nitro nitro-app --install
cd nitro-app

Start the development server:

npm run dev

Nitro is ready at http://localhost:3000/!

Check .nitro/dev/index.mjs if want to know what is happening

Build your production-ready server:

npm run build

Output is in the .output directory and ready to be deployed on almost any provider with no dependencies.

You can try it locally with:

npm run preview
You can find more examples in the Nitro repository: unjs/nitro/examples

Directory structure

The starter template some important files to get you started.

routes/

The routes/ directory contains your application handlers. You can create subdirectories inside routes/ dir to create nested handlers. The file name is the route path.

Read more in Guide > Routing.

api/

The api/ directory is similar to routes/ with the only difference that routes inside it will be prefixed with /api/ for convenience.

Read more in Guide > Routing.

utils/

This directory contains your application utils with auto import support.

Read more in Guide > Utils.

plugins/

This directory contains your custom nitro plugins.

Read more in Guide > Plugins.

nitro.config.ts

The nitro.config.ts file contains the configuration for Nitro.

Read more in Guide > Configuration.

tsconfig.json

The tsconfig.json file contains the TypeScript configuration for your project.

Read more in Guide > Typescript.

package.json

The package.json file contains all the dependencies and scripts for your project.