Legal AI infrastructure for firms
AI RFP discovery and response drafting
Automatic.coBusiness process automation
Secure AI virtual data rooms
Combining Next.js With Shopify for Headless eCommerce Success
Most teams considering a Shopify replatform frame it as a frontend project. In practice it is an integration project with a frontend attached. The storefront is the easy part. The hard part is drawing the boundaries between what Shopify owns, what your Next.js app owns, and how data crosses between them without stale product pages or a broken cart.
Headless commerce is no longer an experiment. The platform market is projected to grow from $2.04B in 2025 to $6.17B by 2031, and Shopify is sitting at the center of it: merchants on the platform processed $378 billion in GMV in 2025. If you are scoping a Next.js + Shopify build this quarter, this is the architecture reference, including when to stop and use Hydrogen instead.
Why Headless Shopify Keeps Winning Replatforms
The business case rarely leads with "we want React Server Components." It leads with speed, SEO, and the content model. Liquid themes hit a ceiling when the marketing team wants a visual page builder, when the catalog crosses six figures of SKUs, or when the site needs to serve three brands off one commerce backend.
Performance is the number everyone cites, and it is defensible. Ecommerce sites that load in one second convert at roughly 3.05% versus 1.68% at two seconds, and a Google/Deloitte study found that a 0.1-second improvement in mobile speed lifted retail conversions 8.4%. Next.js earns its place here. It is the dominant React meta-framework, used by about 68% of JavaScript developers, which also means you can staff the project without a hunt.
The second driver is content. A headless build lets you put Sanity, Contentful, or a custom CMS in front of product data and model landing pages, editorial content, and merchandising rules independently from the catalog. If your current Shopify theme has a sections/ folder nobody wants to touch, that is the real reason you are replatforming.
Storefront API vs Admin API: Draw the Line Early
Every scoping conversation should start here, because mixing these up is how credentials end up in a public bundle. The Shopify Storefront API is a public, GraphQL, read-and-cart API designed to be called from the browser or a server component with a public access token. The Admin API is private, server-side only, and holds every operation that would be catastrophic to leak.
A clean split looks like this:
- Storefront API (public, GraphQL): products, collections, metafields marked storefront-visible, cart creation and line item mutations, discount codes, checkout URL handoff, customer auth via the Customer Account API.
- Admin API (private, server-side): order lookups, inventory reconciliation, draft orders, bulk product writes, webhook registration, anything that touches PII or money movement.
- Customer Account API (OAuth): logged-in customer order history and address management. This is deliberately separate from Storefront and Admin and worth treating as its own integration.
The pattern that holds up in production is Backend-for-Frontend. Your Next.js route handlers proxy Admin calls so Admin tokens never leave the server, while Storefront queries run from React Server Components or edge functions with the public token. Rate limits reinforce the split: Admin GraphQL is point-bucketed per app, while the Storefront API has no fixed request-count ceiling for real buyer traffic, which is why you want catalog reads going through it.
Cart and Checkout: Where the Handoff Actually Happens
This is the section most tutorials skip. In a headless Shopify build, you own the cart UI and the add-to-cart logic, but Shopify owns checkout. The Storefront API returns a cart object with a checkoutUrl. When the shopper hits "Check out," you redirect them to that URL on checkout.yourbrand.com (or the default shop.app domain), Shopify handles payment, tax, fraud, and compliance, then returns them to a thank-you route you control.
Keep the following in mind when scoping:
- Cart state lives in Shopify, keyed by cart ID. Persist that ID in a cookie, not the line items themselves. Hydrate the UI from the Storefront API on each session so inventory and prices stay authoritative.
- Checkout customization on standard Shopify is limited to Checkout Extensibility apps. If merchandising requires deep checkout control (custom fields, bespoke payment logic, B2B approval flows), that is a Shopify Plus conversation, not a Next.js one.
- Subdomain strategy matters for SEO and trust. Serve www from Vercel and checkout from Shopify, with shared analytics IDs so attribution survives the hop.
- Server Actions in the App Router are a clean place to run cart mutations. They keep the Storefront token server-side if you prefer, and they integrate with revalidateTag for optimistic UI.

Webhook-Driven ISR Is the Whole Game
Product pages are the right use case for Incremental Static Regeneration. They have high traffic, change infrequently, and benefit from edge caching. The question is how fresh they need to be. Time-based revalidation (export const revalidate = 60) is a reasonable floor. On-demand revalidation via Shopify webhooks is the ceiling.
The standard event set that Vercel's reference Next.js Commerce template wires up covers six topics: products/create, products/update, products/delete, and the same three for collections. Point each one at a signed route handler, verify the HMAC with your shared secret, then call revalidateTag('products') or revalidatePath('/products/[handle]') with the specific handle from the payload. Products with variants also fire products/update when inventory changes, so this one hook covers out-of-stock badges too.
A few operational notes that save pain later:
- Tag your fetches explicitly (fetch(url, { next: { tags: ['product:'+handle] } })) rather than relying on paths. Tags let you invalidate a single product without blowing the whole collection cache.
- Pre-render only your top SKUs with generateStaticParams. The long tail cold-renders on first hit and caches from there. Teams running catalogs in the tens of thousands routinely find that the top few hundred products cover the overwhelming majority of organic landing traffic.
- Webhook delivery is at-least-once. Make the handler idempotent and return 200 quickly, then do the revalidation work.
- Rotate the webhook secret through the Admin API, not the dashboard, so staging and production stay in sync via infra-as-code.
Hydrogen vs a Custom Next.js Build
Shopify would prefer you use Hydrogen. For a subset of projects, Shopify is right. Hydrogen is a React framework built on Remix, deployed on Oxygen edge hosting, with 30-50% LCP gains over Liquid themes. It ships commerce primitives (cart provider, product forms, analytics hooks) that you would otherwise write yourself, and Oxygen hosting is free with any Shopify plan.
The honest tradeoff: Hydrogen locks you to Shopify's commerce model, Remix conventions, and Oxygen's deployment surface. Next.js on Vercel (or your own infra) buys you a larger ecosystem, better interop with non-Shopify data sources, and the App Router's rendering model. For a Shopify-only storefront with a modest content layer, Hydrogen is faster to ship. For a multi-brand build, a storefront integrated with a separate ERP or PIM, or a team already standardized on Next.js and type-safe API patterns, Next.js wins on fit.
Scoping the Build Honestly
A production headless Shopify storefront on Next.js is not a two-week project. A realistic scope for a mid-market replatform (10k-50k SKUs, one brand, one locale, standard checkout) sits around 10-16 weeks for a senior pod of three to four. The expensive line items are rarely the ones in the proposal:
- Content modeling. If you are introducing a CMS alongside Shopify, mapping metafields to CMS fields and deciding who owns what is a two-week workstream in its own right.
- Search and merchandising. Shopify Search & Discovery is adequate for small catalogs. Beyond that, plan for Algolia, Typesense, or Shopify's own search API with custom ranking.
- Analytics and attribution. Headless breaks the default Shopify pixel. Server-side GTM, Shopify's Customer Events, and a consent manager need design time.
- Internationalization. Markets, currencies, and locale-specific pricing cross both the Storefront API and your routing layer.
If the team scoping the work has not shipped two or three of these before, build in slack. The same discipline that applies to any serious replatform off a constrained starting point applies here, and the same questions belong in the RFP you send out: who owns the integration surface, what the webhook SLA is, and how the cutover gets staged.
A Reasonable Default Stack
Opinionated starting points save weeks of debate. For a Shopify + Next.js build in 2026, this stack holds up:
- Next.js 15 App Router on Vercel, with React Server Components for catalog reads and Server Actions for cart mutations.
- Storefront API via a thin GraphQL client with codegen for type safety; Admin API behind route handlers only.
- Sanity or Contentful for editorial content and merchandised landing pages, keyed by Shopify product handles.
- Signed webhook routes for the six product and collection events, driving tag-based revalidation.
- Shopify Checkout on a dedicated subdomain, Checkout Extensibility for lightweight customization, Plus only if the business case justifies it.
- Observability: Vercel Analytics for Core Web Vitals, Sentry for runtime, and a lightweight log pipeline for webhook delivery.
None of this is exotic. That is the point. A headless Shopify storefront should be boring in architecture and interesting in merchandising. If the API boundary design is clean and the webhook plumbing is honest, the rest is mostly front-end craft and content modeling. If your current proposal spends more pages on the frontend framework than on the integration surface, send it back.
And when you are deciding between Hydrogen and a custom Next.js build, the deciding question is rarely performance. It is where the project will be in two years: still a Shopify-only storefront, or the front door to a wider system. The right engineering partner will tell you plainly which one you are actually building.
