Getting Started
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!
Quick start
- Latest LTS version of Node.js, or Bun.
- Visual Studio Code
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/
!
.nitro/dev/index.mjs
if want to know what is happeningBuild 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
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.
api/
The api/
directory is similar to routes/
with the only difference that routes inside it will be prefixed with /api/
for convenience.
utils/
This directory contains your application utils with auto import support.
plugins/
This directory contains your custom nitro plugins.
nitro.config.ts
The nitro.config.ts
file contains the configuration for Nitro.
tsconfig.json
The tsconfig.json
file contains the TypeScript configuration for your project.
package.json
The package.json
file contains all the dependencies and scripts for your project.