1. Create the shared public config
src/lib/commerce-seo.config.ts
2. Create the server-bound SEO instance
src/lib/seo.ts
3. Serve every discovery surface from one proxy
Next.js 16 usesproxy.ts. On Next.js 15, export the same handler from middleware.ts.
src/proxy.ts
- product/category Markdown mirrors
- same-URL Markdown negotiation
/llms.txt/sitemap.mdrobots.txtsitemap.xmland shards beyond the URL limit
Static/prerendered Next output
If the deployment has no Next server at request time, use the same prebuild strategy as a React/Vite app and write assets intopublic/ with @commercengine/seo/build.
4. Generate native Next metadata
Use the public storefront insidegenerateMetadata:
app/product/[slug]/page.tsx
createCategoryMetadata().
5. Render product JSON-LD and breadcrumbs
Next Metadata covers normal head metadata. Render JSON-LD in the page body:Product schema for the same item.
Product-specific Open Graph properties
productOpenGraphTags() from @commercengine/seo/nextjs exposes product Open Graph fields that do not map cleanly into the generic Next Metadata shape:
6. Register WebMCP in a root Client Component
src/components/AgentTools.tsx
<AgentTools /> once in the root layout. It returns no UI.
7. Hosted Checkout remains human-controlled
If you already use Hosted Checkout, keep its normal root bootstrap. The AI bridge only exposesopen_cart, open_checkout, and optionally open_login; cart mutations themselves use the authenticated Storefront SDK.
See Hosted Checkout + Next.js for the session synchronization pattern.
Production checklist
proxy.tsmatcher includes the.md, robots, sitemap, and discovery paths you enablegenerateMetadatausespublicStorefront()rather than a live session accessor- PDP has exactly one product schema plus its breadcrumb schema
- Client AgentTools imports
commerce-seo.config, not the server SEO module registration?.abort()runs on unmount- development console contains the Commerce AI registration diagnostic
- direct requests to
/product/example.md,/llms.txt, and/sitemap.xmlreturn successfully
Reference starter
Full Next.js production storefront with both packages wired.