Cloudflare Worker serving announcements, status advisories, and release notifications for Theorem.
- Global Edge Serving: Powered by Cloudflare Workers and KV (
ANNOUNCEMENTS_KV). - Zero-Dependency Read Path: Pure JSON responses with strict CORS and 5-minute HTTP edge caching (
Cache-Control: public, max-age=300,ETag). - Fail-Safe Fallback: Bundled fallback seed ensures announcements serve reliably even during KV cold starts or migrations.
- GitOps Workflow: Modify
announcements.jsonvia reviewed PRs. Merging tomaindeploys and updates the edge KV store automatically.
Returns all active announcements. Expired (expiresAt <= now) and future scheduled (publishedAt > now) announcements are filtered on read.
Response:
{
"announcements": [
{
"id": "theorem-1-6-0-release",
"severity": "info",
"title": "Theorem 1.6.0 is available",
"body": "Welcome to Theorem 1.6.0! Support local development via Buy Me Momo, or view what's new on GitHub.\nDetails at https://github.com/Fundaments-Work/Theorem/releases/tag/v1.6.0",
"link": "https://github.com/Fundaments-Work/Theorem/releases/tag/v1.6.0",
"linkLabel": "See what's new",
"publishedAt": "2026-10-08T00:00:00Z",
"expiresAt": null
}
],
"updatedAt": "2026-10-08T00:00:00Z"
}Authorized endpoint for urgent updates or automated publishing.
- Header:
Authorization: Bearer <ADMIN_TOKEN> - Content-Type:
application/json - Body:
{ "announcements": [ ... ] }matchingschema.json.
- Edit
announcements.json. - Ensure each announcement has a unique, stable
id(users store dismissed IDs locally; never reuse an ID). - Validate and test locally:
pnpm test - Open a Pull Request on GitHub.
- Upon merging into
main, GitHub Actions automatically validates the schema and deploys the update to Cloudflare KV.
Defined formally in schema.json:
| Field | Type | Description |
|---|---|---|
id |
string |
Unique, stable identifier (e.g. theorem-1-6-0-release). Required. |
severity |
"info" | "warning" | "critical" |
Severity level. Required. |
title |
string |
Headline text. Required. |
body |
string |
Body message. Supports **bold** formatting and bare https:// URLs. Required. |
link |
string (URI) |
Optional primary CTA URL. Must be https:// without credentials. |
linkLabel |
string |
Optional button label for the CTA link. |
publishedAt |
string (ISO 8601) |
Publication date. Required. |
expiresAt |
string | null |
Optional expiration date after which the announcement is hidden. |
# Install dependencies
pnpm install
# Run tests
pnpm test
# Typecheck
pnpm typecheck
# Start local dev worker
pnpm dev