---
title: Build once, deploy to many hosts
description: Build your app into one folder, then pick where it runs with a Nitro preset.
sidebar: { label: Build and deploy }
---

Last page, you wrote pages, endpoints, and middleware. Now ship them.

The router builds on [Nitro](https://nitro.build). Nitro has presets for many hosts. We built one app for a Node server and for Vercel, with no code change.

Pick a host. Then run the build.

<AppDeployFigure />

Notice that your files stay the same. Only the output folder changes.

## The default: a Node server

```bash
npm run build
PORT=3000 node .output/server/index.mjs
```

The build runs three steps: the browser build, the server build, then Nitro. By default, Nitro builds a Node server. The server reads the `PORT` variable.

To try the build on your machine, run `npm run preview`.

## What is in .output/

| Path | What it holds |
| --- | --- |
| `.output/server/index.mjs` | the server you start |
| `.output/public/build/` | the browser code, sent with `cache-control: public, max-age=31536000, immutable` |
| `.output/markless/router/types/` | the route types |
| `.output/nitro.json` | Nitro build information |

:::warning[Is .output/ in my .gitignore?]
Not in the starter. Its `.gitignore` lists `dist/` and `.markless/`, but not `.output/`. Add it yourself.
:::

## Other hosts with a preset

Nitro reads the preset from the `NITRO_PRESET` variable. This build writes output for Vercel:

```bash
NITRO_PRESET=vercel npm run build
```

The output goes to `.vercel/output/`, with `static/` and `functions/` folders. The Markless website deploys this way.

Nitro has presets for many other hosts. We tested only the default Node server and Vercel with Markless. Treat other presets as untested.

:::warning[Why does my build say "Remove nitro()"?]
The router adds Nitro for you. If you also add `nitro()` to `vite.config.ts`, the build stops. Keep `plugins: [markless(), router()]`.
:::

**Next:** Which options can you change in `vite.config.ts`? [Configuration →](/apps/configuration)
