🛒 E-commerce / Retail

Build APIs at the Edge

Add new API endpoints to any existing website in 15 minutes — no backend sprint needed. Workers create /api/local-price, /api/assembly-guide, /api/match-style, and /api/discover without a single origin change.

The Problem

""HÖMSTYLE has no compatibility API, no assembly guide, no local price localiser — backend sprint needed.""

The Outcome

15 min

to add local-price, match-style, assembly-guide, and bundle-estimate. Zero origin changes.

Live demo below

These endpoints do not exist on your origin server.

A Cloudflare Worker intercepts the request at the edge and responds directly. Your origin never receives these requests. Click any endpoint to see the live response and source code.

0
Origin code changes
~30
Minutes to deploy
4
New endpoints added

Productionising this

What changes when you ship this for real

Versioned API surface

Prefix new endpoints with /api/v1/... from day one. When the AI response shape changes, ship /api/v2/... alongside without breaking embedded clients.

Schema validation

Validate request bodies with Zod at the entry of every handler. Bad input from a third-party integration shouldn't consume Workers AI neurons.

Result caching

Most LLM-derived endpoints (style match, assembly guide) are deterministic for a given input. KV-cache by hash of (endpoint, input) for 24h — saves neurons and improves p50.

Streaming responses

For long-form generation (assembly guides), stream tokens with stream: true on AI.run. Reduces perceived latency from ~3s to ~300ms first-byte.

Rate limit per IP

Add Workers Rate Limiting binding (or KV sliding window). Public AI endpoints are abuse vectors — set per-IP cap (e.g. 30/min) before the AI call.

Cost monitoring

Tag each /api/* response with X-AI-Neurons-Used: N. Aggregate via Workers Analytics Engine to track per-endpoint cost over time.