Getting Started
Intro
Nitro is an open source framework to build web servers using 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 either Node.js, Bun, or Deno.
- Visual Studio Code
Create a new project using starter template:
npx giget@latest nitro nitro-app --install
yarn dlx giget@latest nitro nitro-app --install
pnpm dlx giget@latest nitro nitro-app --install
bunx giget@latest nitro nitro-app --install
deno run -A npm:giget@latest nitro nitro-app --install
cd nitro-app
Start the development server:
npm run dev
yarn dev
pnpm dev
bun run dev
deno run dev
Nitro is ready at http://localhost:3000/
!
.nitro/dev/index.mjs
if you want to know what is happeningBuild your production-ready server:
npm run build
yarn build
pnpm build
bun run build
deno 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
yarn preview
pnpm preview
bun run preview
deno run preview
Directory structure
The starter template includes some important files to get you started.
server/routes/
The server/routes/
directory contains your application handlers. You can create subdirectories inside server/routes/
dir to create nested handlers. The file name is the route path.
server/api/
The server/api/
directory is similar to server/routes/
with the only difference that routes inside it will be prefixed with /api/
for convenience.
server/utils/
This directory contains your application utils with auto import support.
server/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.