Skip to main content
This quickstart wires product metadata, product JSON-LD, and a sitemap into a Next.js App Router storefront. Other frameworks follow the same shape — see the Pages Router, Remix, and Hydrogen guides.
1

Install the package

The package is ESM-only and requires Node 18+. All peer dependencies are optional — nothing extra is pulled in.
2

Set your environment variables

Add both variables to .env.local (and to your deploy platform’s environment):
.env.local
Find your store API key (ask_…) in the AgentShop dashboard under Settings → API Keys — one key per store. It’s a secret: keep it in a server-side env var only (never a NEXT_PUBLIC_* variable or client code). The SDK uses it only on the server, so nothing is exposed to the browser.
3

Add two lines to your product page

app/products/[handle]/page.tsx
createProductMetadata() returns a ready generateMetadata that renders the title, meta description, canonical, Open Graph, and Twitter tags. <ProductJsonLd> is an async server component that renders the Product + BreadcrumbList JSON-LD script. Both work with Next 14 (sync params) and Next 15/16 (Promise params) — no version-specific code needed.Optionally add the sitemap route:
app/sitemap.xml/route.ts
4

Verify

Open a product page and use View Source (Ctrl+U / Cmd+Option+U) — not the DevTools Elements panel. DevTools shows the hydrated DOM; crawlers see the initial HTML, which is what View Source shows.You should see:
  • A real <title> and <meta name="description"> from your Shopify SEO fields
  • <link rel="canonical">, og:*, and twitter:* tags
  • A <script type="application/ld+json"> block with Product and BreadcrumbList
Then validate the structured data with the Google Rich Results Test or validator.schema.org.
The default fetch timeout is 3 seconds — right for the warm production endpoint. If you’re testing against a cold or local backend and tags don’t appear, raise it: createProductMetadata({ timeoutMs: 15000 }).

Where to go next