# Static site recipe

URL: https://briq.cloud/cookbook/static

> HTML, CSS, JavaScript and images served by nginx, from files or a folder of a GitHub repo. No build, no image.

Tags: app, language

Guides:

- [Run your own app](https://briq.cloud/docs/guides/run-your-own-app.md): Your code as a running service, with a URL, in one call and no image to build.
- [Run a GitHub repo](https://briq.cloud/docs/guides/run-a-github-repo.md): An app from a repo, running with a URL. The briq downloads the code itself, and nothing is built on your side.

## Run it

MCP:

```ts
briq_run({
  recipe: "static",
  params: {
    "size": "nano"
  },
  wait: true
})
```

REST:

```bash
curl -X POST https://api.briq.cloud/v1/briqs \
  -H "Authorization: Bearer $BRIQ_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "recipe": "static",
    "params": {
      "size": "nano"
    },
    "wait": true
  }'
# → { "briqs": [{ "id": "bq_…", … }], "outputs": { "SITE_URL": "…" }, … }

# ... when done, for each briq id
curl -X DELETE https://api.briq.cloud/v1/briqs/<id> \
  -H "Authorization: Bearer $BRIQ_API_KEY"
```

## Parameters

| Name | Type | Options | Default | What it does |
| --- | --- | --- | --- | --- |
| `files` | record | { "path": "content" \| { base64 } } | — | The site's files, path → content (text, or { base64 } for images). Relative paths go under /usr/share/nginx/html; index.html is the home page. |
| `repo` | object | { url, ref?, token?, dir? } | — | The site from GitHub instead of `files`: { url: "github.com/owner/site", ref?, dir?, token? }, as for the language recipes. The briq downloads it at each start (a new commit is picked up then) and serves `dir` (e.g. "public") as it is. A site that needs a build runs on the node recipe instead |
| `size` | enum | nano, small | "nano" | — |

## Outputs

Returned by `briq_run` once the stack is healthy. Hosts resolve inside your team network; secrets are generated per run.

| Output | Value |
| --- | --- |
| `SITE_URL` | `http://site.<stack>.internal` |

## What it runs

| Briq | Image | Ports | Size | Volume |
| --- | --- | --- | --- | --- |
| site | `nginx:1-alpine` | 80 | nano | — |

## When to use it

* A page, a report or a small site the agent generated, and a URL to send someone.
* A built frontend (the output of `vite build`) that needs no server of its own.

## Tips

* **A site on GitHub**: `repo: { url: "github.com/owner/site", dir: "public" }` serves that folder
  as it is, downloaded by the briq itself: [Run a GitHub repo](https://briq.cloud/docs/guides/run-a-github-repo).
  A site with a build step runs on the [node](https://briq.cloud/cookbook/node) recipe.
* **Pass the site as `files`**: `{ "index.html": "…", "app.js": "…" }`, images as
  `{ "base64": "…" }`. Relative paths go under nginx's root; `index.html` is the home page.
* **256 KB in all**: for a bigger site, write the files with `briq_files_put` once it runs, or
  fetch them from inside with `briq_exec` (`wget`).
* **Publish it as you run it**:
  `briq_run({ recipe: "static", params: { files }, expose: "private" })` returns a `URL` only the
  people you send it to can open.
* **Step by step**: [Run your own app](https://briq.cloud/docs/guides/run-your-own-app), with a database and a URL.
