# Deploy the docs site

Run, validate, and deploy the Pinter documentation site and its MCP server.

The documentation site lives in two folders:

| Folder | Purpose |
| --- | --- |
| `docs/` | MDX pages, `docs.json` navigation, and `openapi.json` |
| `docs-site/` | Astro app that renders the pages, plus the Node server used in production |

## Run locally

```bash
cd docs-site
bun install
bun run dev --port 3001
```

Use `3001` because the Pinter frontend commonly uses `3000`.

## Validate before publishing

```bash
node docs/check-nav-coverage.mjs
```

The check fails when `docs.json` lists a page that does not exist, when a page links to an internal page that does not exist, or when a referenced local asset is missing.

## Build and serve the production bundle

```bash
cd docs-site
bun run build
bun run start
```

`bun run start` serves `dist/` and the `/mcp` and `/feedback` endpoints on port `8080` (override with `PORT`).

## CI/CD

The `build-docs` job builds the image with Kaniko from `docs-site/Dockerfile` and the `deploy-docs-*` jobs deploy it to Cloud Run. The container listens on port `8080`.

## Update OpenAPI pages

Endpoint pages are generated from `docs/openapi.json`. When backend routes change, regenerate the schema:

```bash
cd pinter-be
python scripts/export_openapi.py
cp docs/openapi.json ../pinter-fe/docs/openapi.json
```

Endpoint pages, search, `llms.txt`, and the MCP server all pick up the new schema on the next build.

## Feedback and logs

The "Was this page helpful?" buttons send `POST /feedback`. The server writes one structured JSON log line per vote (`message: "docs_feedback"`), which you can query in Cloud Logging.
