Newsletter
Join the Community
Subscribe to our newsletter for the latest news and updates
Learn how to avoid calling several services by pre-checking stock at the edge using a redis cache.

Astro landing page starter with gradient background, responsive hamburger/dropdown menu, and switchable floating/fullscreen headers.
Rewriting at the Edge using Upstash is a Next.js example project from the official Vercel examples repository that demonstrates how to avoid calling several backend services by pre-checking stock availability in an Upstash Redis cache at the network edge.
Rewriting at the Edge using Upstash is a reference implementation that combines Next.js edge middleware with Upstash, a serverless Redis service. The project's core function is to check whether an item is in stock before the request reaches a backend service, then use URL rewrites to route the request to the appropriate destination based on that cached stock state. It runs on Next.js, deploys to Vercel with one click, and is styled with Tailwind CSS according to the project metadata.
The README lists two ways to use the example: one-click deploy on Vercel, or cloning locally with create-next-app using the example URL and pnpm. After bootstrapping, you run pnpm dev for development. The middleware reads stock status from Upstash and applies rewrites accordingly, although the exact endpoint and Redis keys are not detailed in the README itself.
It is built with Next.js, uses Tailwind CSS for styling, and integrates Upstash as the Redis provider. The edge middleware feature is available in the Next.js framework.
Execute pnpm create next-app --example https://github.com/vercel/examples/tree/main/edge-middleware/rewrites-upstash rewrites-upstash, then run pnpm dev. This bootstraps the project and starts the Next.js development server.
