Headless E-commerce Architecture
Full headless commerce stack: decoupled storefront, API-first commerce engine, global CDN, and composable services for content, search, and media.
The Stack
Shopify
— Commerce engine (SaaS option) optionalShopify Storefront API and Hydrogen framework provide a battle-tested, fully hosted commerce backend with payments, inventory, and fulfillment built in. Lowest operational overhead for headless.
Alternatives: medusa, saleor, vendure, elastic-path, crystallize
Medusa
— Commerce engine (self-hosted option) optionalOpen-source, Node.js-based headless commerce platform. Full control over data, no per-transaction fees, and a modular plugin system. Best for teams that need deep customisation without vendor lock-in.
Saleor
— Commerce engine (GraphQL-first option) optionalPython/Django headless commerce with a powerful GraphQL API, built-in multi-channel and multi-currency support, and a React Dashboard. Strong choice for marketplaces and B2C.
Elastic Path
— Commerce engine (enterprise composable option) optionalMACH-certified composable commerce platform with flexible catalog, promotions, and cart APIs. Suits complex product models (configurable products, bundles) at enterprise scale.
Next.js
— Storefront frameworkNext.js with React Server Components is the de-facto standard for headless storefronts. Shopify's Hydrogen is built on it; Medusa and Saleor ship official Next.js starter templates.
Alternatives: remix, nuxt, astro, sveltekit
Vercel
— Edge hosting and CDN optionalInstant edge deployments, ISR/On-demand revalidation for product pages, and a global CDN optimised for Next.js. Reduces storefront TTFB to <50ms worldwide.
Algolia
— Product search and discoverySub-10ms search, AI-powered ranking, and merchandising rules. Algolia's InstantSearch UI library accelerates PLP and autocomplete implementation.
Alternatives: typesense, meilisearch, elasticsearch, constructor
Contentful
— Headless CMS for editorial content optionalManages landing pages, banners, blog posts, and campaign content independently of the commerce platform. Marketers can publish without engineering deploys.
Alternatives: sanity, storyblok, prismic, tina-cms
Cloudinary
— Image and video managementOn-the-fly image transformation, responsive srcsets, and automatic format optimisation (WebP/AVIF). Critical for product imagery performance on PDPs.
Alternatives: imgix, cloudinary-sdk
Stripe
— PaymentsStripe Payment Intents API handles cards, wallets, and local payment methods globally. Pairs cleanly with headless checkout flows.
TaxJar
— Sales tax calculation and remittance optionalReal-time tax calculation at checkout for US nexus and Canada. TaxJar AutoFile handles remittance, removing the biggest compliance headache for US merchants.
Alternatives: avalara
Klaviyo
— Email and SMS marketing optionalDeep Shopify/custom event integration for cart abandonment, post-purchase flows, and segmented campaigns. Klaviyo's CDP capabilities reduce the need for a separate analytics tool.
Gotchas
- ⚠️ Inventory sync lag: product availability shown in the storefront can be stale by seconds to minutes when using CDN caching. Implement real-time availability checks on add-to-cart, not just on PLP renders.
- ⚠️ International tax complexity: TaxJar covers US/Canada well but EU VAT (OSS regime) and UK VAT require Avalara or a merchant-of-record solution like Paddle to avoid manual VAT registration in 27+ countries.
- ⚠️ Storefront cache invalidation: ISR revalidation works well for product pages but flash-sale price changes or flash-out-of-stock events require on-demand revalidation webhooks from the commerce platform.
- ⚠️ Checkout redirect vs. embedded: Shopify's hosted checkout cannot be fully embedded in a custom storefront (Shopify Plus unlocks some customisation). Medusa/Saleor allow fully custom checkout but increase PCI scope.
- ⚠️ Bundle complexity: a composable stack of 8-12 services means 8-12 vendor contracts, SLA negotiations, and potential cascade failures. Start with a minimal stack and add services only when the pain is clear.
Related Stacks
Recurring Physical-Goods Subscription Service
End-to-end stack for subscription box businesses: recurring billing, subscriber management, physical fulfilment, shipping, retention, and dunning.
Digital Products Marketplace
Sell software licenses, downloadable assets, templates, courses, and digital content with secure delivery, global tax compliance via merchant of record, and copy protection.
B2B Wholesale & Enterprise Commerce Platform
Technology stack for B2B wholesale and enterprise commerce: tiered pricing, net terms, purchase orders, ERP integration, and account-based buying experiences.