---
name: miri-deploy
description: Deploy a static site (HTML/CSS/JS/images) to miri.dev and get a live URL — including a fixed project URL that always serves the latest deploy. Use when the user wants to publish, deploy, or host a static site/folder, share a preview link, or redeploy an existing miri.dev project. Works via the miridev CLI (or the miridev MCP server).
---

# miri-deploy

Publish any static folder to **miri.dev** and return a live link. For repeated deploys,
use a **project** so the URL stays fixed (`name-<shortid>.miri.dev`) and always serves the
latest version.

## Prerequisites (check once, install if missing)

```bash
command -v miridev >/dev/null || npm i -g miridev-cli   # installs the `miridev` command
```

Login is required for permanent hosting and fixed project URLs:

```bash
miridev login    # opens a browser; if headless, it prints a URL for the user to open
```

If the user is not logged in and cannot log in, you may still do a temporary (guest) deploy,
but WARN them it is short-lived.

## Deploy workflow

1. Identify the folder to deploy (must contain an `index.html` at its root; a single lone
   `.html` file is auto-treated as the index). Subfolders like `assets/`, `panels/` are fine.
2. For image-heavy folders, optimize first so the upload is a few MB, not tens of MB
   (resize to ~800–1200px wide, JPEG quality ~80). Large payloads can fail to upload.
3. Deploy:

   ```bash
   # First deploy of a NEW project (choose a short, kebab-case name):
   miridev deploy --project <name> --dir <folder>

   # Later deploys of the SAME folder — no flag needed, it reuses .miri-project.json:
   miridev deploy --dir <folder>
   ```

4. From the output, capture the **Fixed URL** (`https://<name>-<shortid>.miri.dev`).
5. VERIFY before reporting success — check the index AND at least one asset:

   ```bash
   curl -s -o /dev/null -w "index %{http_code}\n"  https://<name>-<shortid>.miri.dev/
   curl -s -o /dev/null -w "asset %{http_code}\n"  https://<name>-<shortid>.miri.dev/<an-image-or-css>
   ```

   Both must be `200`. If index is 200 but an asset is 404, the upload was likely partial —
   redeploy; do NOT flatten folders (subfolders serve correctly).

6. Report the fixed URL to the user.

## Notes & gotchas

- **Same `--project <name>` reuses the same project** (no duplicates). Prefer reusing the
  folder's `.miri-project.json` over re-passing `--project`.
- The fixed project URL always serves the **latest** successful deploy.
- Do not flatten subdirectories — `folder/image.jpg` references work as-is.
- `miridev deploy -m "notes"` records a deployment note.

## Custom domain (optional)

To serve a project on the user's own domain (paid plan + SMS verification required):
`miridev domains add <domain> --project <name>-<shortid>` (interactive phone verification),
or the web tab at https://www.miri.dev/my-page. The server auto-provisions TLS; the user then
adds one DNS record (`CNAME <sub> → miridev.fly.dev`, proxy off). It follows the project's
latest deploy.

## MCP alternative

If a `miridev` MCP server is available (package `miridev-mcp`), the same thing is done with
the `deploy_website` tool (`projectPath`, optional `projectName` for a fixed URL),
plus `login_miridev`, `check_auth_status`, `get_deployment_status`.

## Reference

- Full LLM guide: https://www.miri.dev/llms.txt
- CLI: https://www.npmjs.com/package/miridev-cli · MCP: https://www.npmjs.com/package/miridev-mcp
- Site: https://www.miri.dev
