🧭 Overview

  • Deployed via Wrangler CLI to Cloudflare Workers
  • No build step β€” worker and static assets are deployed as-is
  • Custom domain: pub.ihnyc-rc.org (requires ihnyc-rc.org on Cloudflare with DNS managed by Cloudflare)

Sources: wrangler.toml, README.md


βš™οΈ Prerequisites

  • Node.js v18+
  • Wrangler CLI
npm install -g wrangler
wrangler login

πŸ”‘ Secrets

Set once per environment; stored encrypted by Cloudflare.

wrangler secret put NOTION_API_KEY

This is the only secret. The three Notion database IDs are non-sensitive and live in wrangler.toml under [vars].


πŸ’» Local Development

wrangler dev

Serves the worker and static assets at http://localhost:8787.

Notion access in dev

wrangler dev will use the secrets and vars from wrangler.toml + your local secret store. If NOTION_API_KEY is not set locally, the /api/events endpoint returns placeholder data β€” the TV display still renders but shows fake events.


πŸš€ Deploy

wrangler deploy

Publishes worker.js as the Worker and uploads ./public as static assets to Cloudflare. Deployment typically takes < 30 seconds.


🌐 Custom Domain

The site is served at pub.ihnyc-rc.org. Requires ihnyc-rc.org DNS to be managed by Cloudflare.

Option A β€” Cloudflare Dashboard:

  1. Workers & Pages β†’ ihnyc-avi-pub-landing β†’ Settings β†’ Domains & Routes
  2. Add β†’ enter pub.ihnyc-rc.org

Option B β€” wrangler.toml:

routes = [
  { pattern = "pub.ihnyc-rc.org/*", zone_name = "ihnyc-rc.org" }
]

Then redeploy: wrangler deploy


πŸ“Š Monitoring

SignalWhere to look
Worker errorsCloudflare Dashboard β†’ Workers & Pages β†’ ihnyc-avi-pub-landing β†’ Logs
API response freshnessFooter countdown on /tv/ β€” shows β€œRefreshing in M:SS”
Notion connectivity/api/events response β€” "source": "notion" confirms live data; absence or placeholder values indicate a Notion failure
Cache behaviourCloudflare Dashboard β†’ Caching β†’ Cache Analytics

πŸ”„ Refresh & Cache Behaviour

LayerTTLNotes
Cloudflare edge cache2 minKeyed on request URL; set by worker
TV client soft refresh2 minFetches /api/events, re-renders in-place
TV client event re-eval1 minClient-side only β€” no network request
TV hard meta refresh5 minFull page reload fallback if JS hangs

To force a fresh API response during an incident, purge the Cloudflare cache for pub.ihnyc-rc.org/api/events from the dashboard or via the Cloudflare API.

Important distinction:

  • The 2-minute soft refresh only pulls /api/events
  • Frontend file changes to /tv/, script.js, or CSS do not apply to an already-open TV session until a full page reload occurs
  • The 5-minute hard refresh is the current fallback for picking up deployed frontend asset changes automatically

πŸ› οΈ Updating Notion Property Names

All Notion property names the worker reads are defined as constants at the top of worker.js. If a Notion database property is renamed, update the corresponding constant:

// Events DB
const PROP_TITLE = "Name"
const PROP_DATE_START = "Event Start"
const PROP_DATE_END = "Event End"
const PROP_LOCATION = "Location"
const PROP_TV_INCLUDE = "Include on Pub TV"
const PROP_SOURCE_EMAIL_SUBJECT = "Source Email Subject"
 
// Shifts DB
const SHIFT_PROP_DATE_TIME = "Date/Time"
const SHIFT_PROP_OPERATIONAL_TIMEFRAME = "Operational Timeframe"
const SHIFT_PROP_LAST_CALL = "Last Call"
const SHIFT_PROP_NOT_IN_PUB = "Not in Pub"
const SHIFT_PROP_ASSIGNMENTS = "Assignments DB"
 
// Assignments DB
const ASSIGNMENT_PROP_PUB_TENDERS = "Pub Tenders DB"
const ASSIGNMENT_PROP_DATE_TIME = "Date/Time"
 
// Announcements DB
// Uses the shared Name title plus:
// - Include on Pub TV (checkbox)
// - Content (rich text, optional)

After updating, redeploy with wrangler deploy.

Sources: worker.js (CONFIG section)