π§ 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(requiresihnyc-rc.orgon 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_KEYThis is the only secret. The three Notion database IDs are non-sensitive and live in wrangler.toml under [vars].
π» Local Development
wrangler devServes the worker and static assets at http://localhost:8787.
Notion access in dev
wrangler devwill use the secrets and vars fromwrangler.toml+ your local secret store. IfNOTION_API_KEYis not set locally, the/api/eventsendpoint returns placeholder data β the TV display still renders but shows fake events.
π Deploy
wrangler deployPublishes 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:
- Workers & Pages β
ihnyc-avi-pub-landingβ Settings β Domains & Routes - 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
| Signal | Where to look |
|---|---|
| Worker errors | Cloudflare Dashboard β Workers & Pages β ihnyc-avi-pub-landing β Logs |
| API response freshness | Footer 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 behaviour | Cloudflare Dashboard β Caching β Cache Analytics |
π Refresh & Cache Behaviour
| Layer | TTL | Notes |
|---|---|---|
| Cloudflare edge cache | 2 min | Keyed on request URL; set by worker |
| TV client soft refresh | 2 min | Fetches /api/events, re-renders in-place |
| TV client event re-eval | 1 min | Client-side only β no network request |
| TV hard meta refresh | 5 min | Full 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)