Reference architecture

From camera to Workers AI and back

A static map of how this demo pushes frames to Cloudflare, runs DETR and vision models on Workers AI, and renders results back over the live video.

Astro · Workers · Workers AI · Rate limiting open public demo · cost-bounded
See the architecture

Reference architecture

Generated Cloudflare Developer Platform architecture

Workers Warm style · generated from an architecture brief

Architecture diagram showing browser camera frames passing through Cloudflare Access to an Astro Worker and Workers AI models, then returning detection JSON and event logs.

Open demo guardrails

Why you might see a rate-limit message

This is a public, unauthenticated demo, so it ships cost guardrails that keep Workers AI spend bounded. None of these limits exist when you deploy the project yourself — set PUBLIC_DEMO_MODE=false (and remove the caps) for a production deployment.

Per-session rate limit 90/min object detection
Per-session rate limit 6/min PPE vision checks
Global daily cap 50,000 detections / day
Global daily cap 2,000 PPE checks / day

The PPE vision model is the most expensive path, so in demo mode it runs on demand (the "Analyze frame" button) rather than on a continuous loop. Per-session limits are enforced with the Workers Rate Limiting binding; the global daily caps are enforced by a Durable Object so spend is bounded across all visitors.

Route by route

The same camera stream, three different products

/

Live detection

camera/api/detectDETRoverlay

One DETR inference per sampled frame. Bounding boxes render directly over the live feed.

/zone

Zone monitor

cameraDETRgeometryevent log

Person boxes are intersected with a normalized zone. Entry and exit events stay in memory.

/ppe

PPE monitor

camera/api/detectDETR
camera/api/ppevision LLM

Fast boxes stay responsive while a selectable vision model checks headwear on demand (or on a loop when self-hosted).

Why this shape?

The same platform primitives support live detection, virtual perimeter monitoring, and PPE compliance with only route-level behavior changes.

Push expensive work to Workers AI

DETR and the selectable vision models run behind an AI binding while the browser keeps capture and overlay state lightweight.

Keep state in the browser

Zones, event logs, model choices, and PPE assessment state are tab-local, so the demo avoids extra persistence services.

Open, but cost-bounded

The public demo runs without authentication. Instead of gating access, it bounds Workers AI spend with per-session rate limits and a global daily budget cap, and records usage in Analytics Engine. Cloudflare Access remains an optional way to run a private deployment.