# workers-agent

Minimal [Cloudflare Workers](https://developers.cloudflare.com/workers/) consumer
of [`@nexartis/homeport-sdk`](https://www.npmjs.com/package/@nexartis/homeport-sdk).

One route — `GET /health` — uses `HomeportClient` to call the Homeport
`deepHealth()` endpoint from the edge and returns the JSON result.

## Prerequisites

- Node 20+ and `pnpm`
- A Cloudflare account authenticated locally (`wrangler login`)
- A Homeport API key

## Install

```bash
cd examples/workers-agent
pnpm install
```

## Configure

Set the API key as a secret (not committed to the repo):

```bash
wrangler secret put HOMEPORT_API_KEY
```

The base URL defaults to `https://homeport.example.com` via `wrangler.jsonc`
`vars`. Override it per-environment by adding an `env.*` block or by running
`wrangler dev --var HOMEPORT_BASE_URL:https://your-node`.

## Run locally

```bash
pnpm run dev
curl http://localhost:8787/health
```

## Deploy

```bash
pnpm run deploy:dev
pnpm run deploy:prod   # release-owner path only
```

For audits and local validation, deploy only the dev environment.

See the top-level [examples index](../README.md) for more examples.
