# `hamur deploy`

`hamur deploy [root]` builds the app and runs the platform's own CLI on the result. It never installs a CLI and never calls a platform API: it finds the one you installed with `PATH`, runs it in the app root with your login or token, streams its output and exits with its exit code.

````sh [deploy-command.sh]
hamur deploy
hamur deploy --preview
hamur deploy --prebuilt --dry-run
````

It ships to production by default, and a draft with `--preview`: `vercel deploy` and `netlify deploy` create drafts unless they get `--prod`, so a command named `deploy` would otherwise ship a draft. `--prebuilt` skips the build and deploys what `.output/hamur.json` says was built, with that build's preset, also a preset of your own. `--dry-run` builds nothing, prints the exact command and runs nothing; the preset is then the config's or `--preset`.

| Preset                                        | Production                                                                 | `--preview`                                                             |
| --------------------------------------------- | -------------------------------------------------------------------------- | ----------------------------------------------------------------------- |
| `cloudflare`, `cloudflare-static`             | `wrangler deploy --config .output/wrangler.json`                           | `wrangler versions upload --config .output/wrangler.json`               |
| `cloudflare-pages`, `cloudflare-pages-static` | `wrangler pages deploy .output/public`                                     | `wrangler pages deploy .output/public --branch preview`                 |
| `vercel`, `vercel-static`                     | `vercel deploy --prebuilt --prod`                                          | `vercel deploy --prebuilt`                                              |
| `netlify`, `netlify-edge`, `netlify-static`   | `netlify deploy --no-build --dir dist --prod`                              | `netlify deploy --no-build --dir dist`                                  |
| `azure-swa`                                   | `swa deploy .output/public --api-location .output/server --env production` | `swa deploy .output/public --api-location .output/server --env preview` |

`--no-build` keeps the Netlify CLI from building again, which would clear `.netlify/v1` where the function and edge function of the build are. `swa deploy` targets `preview` unless `--env production` says otherwise. `wrangler pages deploy` deploys to production when the current Git branch is the project's production branch, and to a preview otherwise; with `--preview` the branch is `preview`. The paths follow `outputDir`.

A CLI that is not on `PATH` exits 1 and prints the line to run it without installing it, for example `wrangler not found on PATH; install it or run: bunx wrangler deploy --config .output/wrangler.json`; nothing is run. A preset with no deploy command exits 1: `The "node" preset has no deploy command; see the deploy page for node`. A preset of your own sets `deploy: { cli, production, preview }` with the arguments of each command, see [`definePreset`](/api-reference/kit#definepreset-preset-presetcontext).
