> ## Documentation Index
> Fetch the complete documentation index at: https://momentic.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Self-host the result viewer

> View Momentic run results outside the dashboard by self-hosting the static result viewer bundle shipped with the CLI.

Momentic's result viewer is a static JavaScript bundle that can render any
Momentic run-result zip. You can host it yourself on any static host instead of
uploading runs to the dashboard. All you need is somewhere to serve the bundle
and somewhere reachable to store the zipped run results.

The example below uses AWS S3 for both, but any static host works. The bundle is
framework-agnostic and the zips need to be reachable over HTTP with CORS.

## 1. Host the static JavaScript bundle

### Create a bundle-hosting bucket

Create a publicly readable bucket following the
[S3 static website documentation](https://docs.aws.amazon.com/AmazonS3/latest/userguide/WebsiteHosting.html).

### Upload the `run-viewer-static` bundle

Upload the contents of the `run-viewer-static` directory from the Momentic npm
package. The current bundle is available on the
[momentic npm page](https://www.npmjs.com/package/momentic), or from your
project at `node_modules/momentic/run-viewer-static`.

The bucket should contain:

```
index.html
assets/
  index-*.js
  index-*.css
```

## 2. Host the run-result zips

### Create a results bucket

The bucket needs to be reachable from wherever the bundle is hosted. For this
example a publicly readable bucket works.

### Upload the test-results directory

CLI runs write to `./test-results` by default (override with
[`--output-dir`](/cli-reference/momentic/commands/run)). The directory contains:

* `metadata.json`: metadata for the full run group
* `runs/<run_id>.zip`: one zip per individual run

Upload each `runs/*.zip` to the results bucket.

### Allow CORS from the viewer origin

Add a CORS policy that allows `GET` and `HEAD` from the bundle-hosting bucket's
URL (replace `hosted-run-viewer` with your bundle bucket name):

```json theme={null}
[
  {
    "AllowedHeaders": ["*"],
    "AllowedMethods": ["GET", "HEAD"],
    "AllowedOrigins": ["https://hosted-run-viewer.s3.us-east-2.amazonaws.com"],
    "ExposeHeaders": ["Content-Length", "Content-Type", "ETag"],
    "MaxAgeSeconds": 3000
  }
]
```

## 3. View a run

Navigate to the viewer's `index.html` with a `zipUrl` query parameter pointing
at the run zip:

```
https://hosted-run-viewer.s3.us-east-2.amazonaws.com/index.html?zipUrl=https://hosted-run-viewer-files.s3.us-east-2.amazonaws.com/16e441b5-5aea-4fd2-9411-1b0115a01986.zip
```

The viewer fetches and unpacks the zip in the browser. No server component is
required.

## Related

* [Results and reporting](/running-tests/results)
* [`momentic run`](/cli-reference/momentic/commands/run)
* [`momentic results view`](/cli-reference/momentic/commands/results)
