OCP Next.js Store
A Next.js 15 example demonstrating how to serve an Open Commerce Protocol manifest from an App Router route handler running on the edge.
What this example shows
- Server-side OCP manifest at
/.well-known/ocp.json— rewritten to an App Router route handler. - Typed manifest using
@opencommerceprotocol/spec. - Edge runtime (
runtime = 'edge') so it deploys to Cloudflare Pages or Vercel Edge. - CORS + cache headers set on the manifest response so agents can fetch it cross-origin.
How it's wired up
next.config.ts rewrites /.well-known/ocp.json to /api/ocp/manifest, which is implemented in src/app/api/ocp/manifest/route.ts. That route returns an OCPManifest describing the merchant, capabilities (catalog, search, cart, redirect checkout), and shipping regions.
An agent discovering this store fetches the manifest first, reads the capabilities, then calls the endpoints it advertises.
Live manifest
Fetched client-side from /.well-known/ocp.json:
Loading…