Skip to content

UF1: the monitor on Workers - #2

Merged
ruehowl merged 1 commit into
mainfrom
uf/1-the-monitor-on-workers
Oct 28, 2026
Merged

ruehowl merged 1 commit into
mainfrom
uf/1-the-monitor-on-workers

Conversation

@ruehowl

@ruehowl ruehowl commented Oct 28, 2026

Copy link
Copy Markdown
Contributor

UptimeFlare's status page and its checker as ONE Cloudflare Worker.

  • apps/web — upstream's pages, components, locales and config (pages router, Mantine 7, Chart.js, i18next) on Next 16 + @opennextjs/cloudflare instead of @cloudflare/next-on-pages. Edge-runtime exports dropped; the two API routes are Node API routes with the same headers and bodies; bindings come from getCloudflareContext().
  • monitor/ — upstream's worker/src, loop unchanged. Binding DB, table monitor_state (the lowercase slug is this repo's identity, which the rename engine rewrites). The Durable Object remote checker is left out: a worker:// proxy reports the monitor down, or checks locally with checkProxyFallback.
  • worker.ts — cron-starter's custom entry: OpenNext's fetch + the checker's scheduled on one every-minute Cron Trigger.
  • proxy.ts — upstream's Basic-auth gate; the password is the optional Orun secret STATUS_PAGE_PASSWORD, handed to the Worker as a secret, never committed.
  • wrangler template + fixture + committed render; component.yaml (smoke: /api/data's updatedAt no older than 10 minutes).
  • tests/web (23 tests): compacted state, the scheduled loop against real SQLite (HTTP, keyword, TCP, worker://, fallback, webhook), the API routes, the password gate, the props handed to the browser (CVE-2026-29779).

Verified locally: pnpm install, wire:fixture (no diff), typecheck, lint, test, build; wrangler dev --test-scheduled — a fired trigger checked every monitor, /api/data read the state back, the component's own smoke passed (and with a password, refused without it); the client bundle carries no monitor config.


Generated by Claude Code

UptimeFlare's status page and its checker, one Cloudflare Worker:

- apps/web: upstream's pages, components, locales, styles and config
  (Next.js pages router, Mantine 7, Chart.js, i18next), on Next 16 and
  @opennextjs/cloudflare instead of @cloudflare/next-on-pages. The edge
  runtime exports are gone (OpenNext runs the Node runtime), the two API
  routes are Node API routes with the same headers and bodies, and the
  pages read the D1 binding through getCloudflareContext() instead of
  process.env.
- monitor/: upstream's worker/src, its loop unchanged; the binding is DB
  and the table monitor_state (the lowercase slug is this repository's
  identity, which the rename engine rewrites). The Durable Object remote
  checker is left out: a worker:// check proxy reports the monitor down,
  or checks it locally under checkProxyFallback.
- worker.ts: the custom entry (cron-starter's shape) — OpenNext's fetch
  plus the checker's scheduled handler on ONE Cron Trigger, every minute.
- proxy.ts: upstream's Basic-auth middleware, its password the optional
  Orun secret STATUS_PAGE_PASSWORD handed to the Worker as a secret by the
  build, never a string in the committed config.
- the wrangler template (the trigger, the DB token) and its fixture, the
  committed fixture render, and component.yaml (dev verifies; stage and
  prod deploy on main, smoke-tested on a check the trigger recorded).
- tests/web: the compacted state, the scheduled loop against real SQLite
  with every check kind and the webhook, the API routes, the password
  gate, and the props the page hands the browser (CVE-2026-29779).

Mantine's react-textarea-autosize resolves an edge-light build under the
workerd condition that Next's tracing never copies; next.config.mjs traces
it in.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019PcpNVpFBcbeiX3EHdXfmn
@ruehowl
ruehowl merged commit ab147c7 into main Oct 28, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants