Skip to content

Tyler-Irving/om-schedule-proxy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

om-schedule-proxy

Cloudflare Worker that fetches the Ole Miss football schedule from ESPN and returns a slim JSON payload sized for a Garmin Connect IQ watch face.

ESPN's team-schedule response is ~400 KB. Connect IQ's Communications module enforces a ~32 KB cap on JSON responses to watch-face background services, so the watch can't ingest the upstream payload directly. This worker strips each event down to the five fields the watch face actually uses and returns ~1–2 KB.

Output shape

{
  "events": [
    {
      "opponent":   "Alabama",
      "kickoffSec": 1762113600,
      "confirmed":  true,
      "status":     "STATUS_SCHEDULED",
      "home":       false
    }
  ]
}
Field Notes
opponent Prefers shortDisplayNamelocationdisplayName"TBD".
kickoffSec Unix seconds (UTC). Watch hydrates this into a Time.Moment.
confirmed false when ESPN's status detail contains "TBD" (kickoff time set).
status ESPN status name, e.g. STATUS_SCHEDULED, STATUS_FINAL.
home true if Ole Miss is the home competitor.

Endpoint

  • GET / — current season's schedule.
  • GET /?season=2025 — specific season. Useful out-of-season; the watch leaves this off so it always tracks the current year.

Non-GET methods return 405. Upstream errors return 502 with a JSON { error, detail } body.

Caching

Two layers, both keyed on the upstream URL (so ?season=YYYY and the default endpoint don't collide):

  1. Cloudflare edge cache via fetch(..., { cf: { cacheTtl, cacheEverything } }) on the upstream call.
  2. Workers Cache API (caches.default) on the slimmed response.

Both use a 5-minute TTL. The watch face polls every 15 minutes during its live window, so this keeps ESPN traffic well under the Workers free-tier budget (100k requests/day).

Development

npm install
npm run dev      # wrangler dev — local worker on :8787
npm run deploy   # wrangler deploy
npm run tail     # stream production logs

Requires a Cloudflare account configured via wrangler login. Observability is enabled in wrangler.toml, so logs and request analytics show up in the Cloudflare dashboard automatically.

Layout

src/index.ts     # worker entrypoint + ESPN payload parser
wrangler.toml    # worker config (compat date, observability)
tsconfig.json    # strict TS, Workers types

About

Cloudflare Worker that slims ESPN's Ole Miss football schedule into a ~1–2 KB JSON payload for a Garmin Connect IQ watch face.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors