Headless commerce development for storefronts a theme can't hold
Brands that publish as much as they sell, or run several storefronts from one catalog, end up bending a theme around content it was never built for. A headless storefront separates the pages shoppers see from the engine that holds products and orders, so each can change without the other.
Updated
What it is
Headless commerce is an online store architecture in which the storefront shoppers see is a separate application from the commerce engine that holds products, carts and orders, and the two talk through APIs. The storefront can be built in any framework and hosted anywhere while the engine keeps running the catalog, inventory and orders.
When it makes sense, and when it doesn't
When it makes sense
- Lookbooks, guides or recipes have to sit beside products and be edited in a real CMS, with previews and scheduled publishing.
- One catalog feeds several storefronts: separate brands, a wholesale site, or regional sites with their own content.
- The store needs interactive tools a theme handles badly, such as a product configurator or a fit finder.
- Your commerce rules, such as multi-vendor payouts, quote-based B2B ordering or rental periods, don't fit Shopify's model. That's where Medusa comes in.
When it doesn't
- Your catalog is standard and the store is slow because of app scripts. A rebuilt theme fixes that for less; see Shopify development.
- You mainly want to change Shopify's checkout. A headless storefront still hands shoppers to it, so going headless changes the pages before checkout, not checkout itself.
- Nobody will keep a JavaScript application current after launch. A headless storefront needs the framework and API updates that a theme store mostly gets from Shopify.
How we run it
Cache the catalog, never the cart
Product and collection pages are rendered on the server and cached at the edge, and a product webhook clears only the pages that product appears on, so a price change reaches shoppers without a full rebuild. Carts, accounts and stock messages are fetched on every visit, since a cached cart is someone else's cart.
Hand the cart to checkout under the brand's domain
On Shopify, the storefront builds the cart through the Storefront API and sends the shopper to its checkout URL, served from a subdomain like checkout.yourbrand.com, so the address bar keeps the brand's domain instead of a myshopify.com address. Discount codes travel with the cart, and the analytics setup follows the visit across both hostnames.
Join editorial content to live product data
Sanity or Contentful holds the editorial side, and each piece references products by handle, so a buying guide shows current prices and stock instead of copies that go stale. Editors preview drafts on the real storefront, and publishing refreshes only the pages that content touches.
Write Medusa order logic as workflows
On Medusa, custom rules such as reserving rental dates or splitting an order between vendors become workflows whose steps each carry a compensation function, so a failed payment releases whatever an earlier step reserved. Sales channels and stock locations let a wholesale site and a retail site share one inventory, and staff work in the Medusa Admin, extended with screens for the custom rules.
Rebuild what the theme supplied
A theme store gets Shopify's sitemap and robots.txt, plus whatever product markup and app blocks its theme includes. A headless storefront has to produce each of these itself, so they sit on the build list from the start, and e-commerce SEO can review the templates before launch.
One order through a headless store
Seven hops from a page view to the confirmation email, plus the detour a declined card takes.
Storefront renders
Product and collection data come from Shopify's Storefront API or Medusa's store API, served from the edge cache.
Cart
Built on the server through the cart API, with the cart's ID kept in a cookie so it survives a closed tab.
Hand-off to checkout
On Shopify, the shopper moves to Shopify's checkout; on Medusa, to a checkout page in the storefront's own code.
Payment
Shopify's checkout collects payment itself. On Medusa, Stripe's Payment Element takes the card and Stripe authorizes it.
A declined payment returns the shopper to the same cart, and on Medusa any stock reserved for the order is released.
Order webhooks
Shopify's orders/create webhook, or a Medusa subscriber to the order.placed event, starts every downstream system.
Stock and fulfillment
Stock drops at the shipping location, and the order goes to the warehouse or 3PL that will pick it.
Order emails
The confirmation goes out through Shopify's notifications or Medusa's notification module, and Klaviyo records the order for later flows.
Tools used
Shopify Hydrogen
Cart, consent-aware Shopify analytics and a typed Storefront API client inside Next.js or React Router
Medusa
Workflows with compensation steps, sales channels and stock locations
Sanity
Editorial content that references products by handle, with live preview
Stripe
The Payment Element, collecting card and wallet details at checkout
Frequently asked questions
Does headless commerce make a store faster?
Not by itself. Speed comes from what each page sends and how it's cached, so a lean theme can be quick while a careless headless build is slow. Headless helps most when the weight comes from a page-builder app or a theme structure that can't be slimmed down, because the storefront then loads only the code each page uses. Judge the result on field data from real visits, not one lab test.
Which framework should a headless Shopify store use?
The one your team will maintain, because Hydrogen no longer decides it. In its current version, Shopify's headless toolkit is a library that adds the cart, variant selection, consent-aware analytics and customer login to frameworks such as Next.js, React Router, Nuxt or Astro. Shopify's docs offer a React Router template for Oxygen, Shopify's hosting for Hydrogen storefronts, and Vercel's Next.js template for Vercel. Shopify says storefronts on the older Hydrogen framework keep working as they do, for now.
Is Medusa a good alternative to Shopify?
For some stores. Medusa is an open-source commerce engine under the MIT license, written in TypeScript on Node.js, so every rule, checkout included, can change in code and run wherever Node.js runs, or on Medusa Cloud. The trade-off is that payment setup, tax calculation and keeping the server healthy become ongoing developer work, where Shopify handles them itself. It suits businesses with unusual commerce logic and a developer on hand.
Can a headless Shopify store still use Shopify apps?
Some of them. Apps that work in Shopify's back office, such as inventory, fulfillment or subscription billing, keep working, and checkout apps still run because checkout is still Shopify's. Apps that inject widgets into theme pages, such as reviews, upsells or quizzes, don't appear on their own; they need the app's API or JavaScript SDK built into the storefront, and some apps offer neither. Check every installed app before choosing headless.