Build Story
The road to working
💡
STEP 01 · IDEA
200 emails, zero visibility
A year of PSE&G threshold notifications sat unread in Gmail. The data was there — date, kWh, threshold type — in every single snippet. Just needed a bridge to make it visible.
🏗
STEP 02 · ARCHITECTURE
Cloudflare Pages + KV + Gmail API
Static HTML dashboard, a Pages Function as the API layer, KV for caching. Zero servers. The whole stack runs at the edge for free.
⚠️
STEP 03 · FIRST BLOCKER
Workers vs Pages confusion
Cloudflare's new unified UI merges Workers and Pages — creating a Worker instead of a Pages project served hello world instead of the dashboard. The fix was buried at the bottom of the create screen.
"Looking to deploy Pages? Get started" ← that link
🚫
STEP 04 · DEPLOY COMMAND HELL
The UI requires a deploy command it shouldn't need
Pages handles deployment automatically via GitHub integration. But the new UI forces a deploy command. The workaround that finally worked:
Deploy command: echo "deploy"
🐛
STEP 05 · THE BUG
Gmail batch API silently fails above 100 requests
The original approach sent all 200+ message IDs to Gmail's batch API in one request. Gmail's batch limit is 100 — exceed it and it returns nothing, no error. Zero emails parsed. Zero readings.
✅
STEP 06 · THE FIX
messages.list already includes snippets
The batch API was never needed. Gmail's messages.list response already contains the snippet for each message inline. One API call, all the data. Dropped from 100+ subrequests to 2.
messages.list?q=from:MyMeter@email.pseg.com&maxResults=500