YouTube analytics on the edge

Monitor your channel with Cloudflare Pages + R2.

A lightweight dashboard that fetches your YouTube channel details, stats, and latest uploads via a Pages Function and caches the bundle in R2 to protect your API quota.

What it does

  • Edge fetcher: Worker pulls channel, uploads, and video stats.
  • R2 cache: Reduces YouTube API calls with configurable TTL.
  • API-first: `/api/channel` for JSON bundles and force-refresh.
  • Zero secrets on client: API key stays inside the worker.

YouTube intelligence

Channel snapshot

Loading channel data…

Updated

Channel description will load here.

Country
Topics
Keywords

Stats

Subscribers

Total views

Videos

Uploads playlist

Latest uploads

Showing up to 15 most recent videos

  • No videos found yet.

What this monitor covers

Channel intelligence

Title, handle, description, topics, keywords, country, and channel timestamps pulled directly from the YouTube Data API.

See live data →

Smart caching

Bundles are stored in R2 with a configurable TTL to prevent hot partitions or API overuse while keeping data fresh.

Configure TTL →

API endpoint

Use `GET /api/channel` for cached reads or append `?refresh=true` / POST to force a live pull from YouTube.

API details →

Deploy in minutes

Single `wrangler pages deploy` pushes the dashboard and worker; bind an R2 bucket and you're live.

Deployment steps →

How it works

The Pages Function fetches channel details, the uploads playlist, and video stats, then writes the normalized bundle to R2. The front end reads from `/api/channel` and renders cards for channel metadata, stats, and the latest uploads.

  • Edge-first architecture: no secrets in the browser.
  • R2-backed caching with TTL control.
  • Optional cron or CI trigger via POST refresh.

Deploy in one command

Pages serves the dashboard and runs the Function; R2 holds the cached payload. Set your API key as a secret, channel id as a var, bind the bucket, and ship.

Once deployed, hit `GET /api/channel?refresh=true` to prime the cache, or rely on the UI refresh button.

Use Cloudflare Pages for the marketing site while your services ship via Docker or Kubernetes. The repo already contains manifests you can adopt or customize.

Need a baseline health check? See `docs/individual-contributor/HEALTH_CHECKS.md` and mirror the probes in `deployment/docker/Dockerfile.template` and `deployment/kubernetes/` overlays.

wrangler secret put YOUTUBE_API_KEY
kubectl apply -k deployment/kubernetes/overlays/dev
npm run test   # or your stack equivalent

Tune `CACHE_TTL_SECONDS` in wrangler.toml to balance freshness vs. quota.

Update these when you introduce stack-specific tooling.

Watch your channel from the edge

Deploy the monitor, pin your channel id, and keep an eye on subscribers, views, and the latest uploads without exposing your API key.

View on GitHub