Performance
Stale-While-Revalidate Shop
Catalog API with SWR Cache-Control headers, Redis/memory backing, and a freshness timeline.
Run this experiment yourself
Demos are not embedded on this site. Deploy a standalone copy on Vercel or run the experiment app locally.
Local development
cd apps/experiments/stale-while-revalidate-shop pnpm install pnpm dev
Then open http://localhost:3010.
This is an experimental demo. Use it as a starting point for your own projects.
Shop catalog route demonstrating stale-while-revalidate headers with Redis or memory backing.
Features
- Standalone Next.js app under
apps/experiments/stale-while-revalidate-shop/. - Honest degradation when optional services are missing.
- Unit-tested helpers in
logic.ts.
API Reference
GET /api/catalog
(no body)Implementation Details
Run the demo
Use the embedded playground or pnpm dev in the experiment app.
Inspect the handlers
Copy Route Handlers from apps/experiments/stale-while-revalidate-shop/ into your project.
Limitations
- Educational demo — not a production-hardened product.
- Inputs are length-capped.
Use in your project
Copy the experiment folder or individual Route Handlers.
Deployment
Local Development
cd apps/experiments/stale-while-revalidate-shop
pnpm install
pnpm devConfiguration
| Variable | Required | Purpose |
|---|---|---|
| — | — | No required secrets |
Vercel / Next.js Features Used
- Next.js, Upstash Redis, Cache-Control