
Website Performance
How the SaaSpocalypse Ended DXP as a Category
With AI changing the unit economics of creating for the web, find out what's next for digital platforms in the post-DXP world.
Learn how headless commerce architecture works, how data flows between each layer and where to host your decoupled website.
Headless commerce has become one of the defining architectural shifts in modern e-commerce, but the term is often reduced to a simple idea of “decoupling the frontend from the backend”.
In reality, designing a successful headless commerce architecture involves far more than choosing a framework or exposing APIs. It requires understanding how the different layers fit together, how requests move through the stack, and which architectural decisions actually improve performance.
This guide breaks down the mechanics of a modern headless commerce architecture, explains the trade-offs behind today's leading approaches, and shows how to build a stack that's fast, flexible and built to scale.
A headless architecture separates presentation from commerce logic, but the stack itself is more than just a frontend and a backend. It consists of several independent layers, each with a single responsibility:
Layer | Primary responsibility | Common technologies |
|---|---|---|
Frontend | Renders the customer experience and handles user interactions. | |
API layer | Connects the frontend to backend services. | REST APIs, GraphQL, API gateways |
Commerce backend | Stores products, pricing, inventory, carts, orders and customer data. | |
Headless CMS (optional) | Manages editorial content separately from commerce data. | |
Supporting services | Add specialized capabilities without expanding the commerce platform. | Search, personalization, recommendations, payments, tax, shipping, analytics |
Here’s a closer look at each layer:
The API layer is the communication bridge between the storefront and the commerce backend. Every time a shopper views a product, adds an item to their cart or completes checkout, the frontend sends one or more API requests to the appropriate backend service, which processes the request and returns the data needed to update the page. Because the two layers are completely independent, either side can evolve without requiring changes to the other.
A typical request looks like this:
As applications grow, the API gateway becomes increasingly important. Rather than having the frontend communicate directly with every service, the gateway provides a single entry point. It handles concerns such as authentication, authorization, request routing, rate limiting and response aggregation before forwarding requests to the appropriate backend systems. The result is a simpler frontend architecture and a more secure, manageable API surface.
The two most common API styles are REST and GraphQL.
REST is an excellent choice for straightforward integrations and CRUD operations. However, high-traffic commerce sites often benefit from GraphQL because product pages typically need data from multiple sources, such as product information, inventory, pricing, reviews and related products. Instead of making several REST requests or receiving oversized payloads, the storefront can request only the fields it needs in a single query. That reduces network overhead and gives frontend developers greater control over how data is fetched and rendered.
Headless commerce focuses on one architectural decision: separating the frontend from the commerce backend. The storefront becomes an independent application that communicates with the commerce engine through APIs. This gives teams complete freedom over the customer experience while leaving the underlying commerce platform responsible for products, pricing, inventory, carts and orders.
Composable commerce takes modularity much further. Instead of relying on a single platform for every commerce capability, organizations assemble their stack from specialized services. One vendor might provide the product catalog, another search, another checkout, another CMS and another payments. Because every service exposes APIs, each component can be replaced without rebuilding the rest of the platform. The goal is flexibility across the entire commerce stack, not just the storefront.
Every composable commerce architecture is effectively headless because its services communicate through APIs. However, not every headless architecture is composable. Many organizations keep a traditional commerce platform behind their APIs while replacing only the storefront.
Then you have MACH, which stands for microservices, API-first, cloud-native and headless. Rather than describing a product category, MACH is a set of architectural principles promoted by the MACH Alliance. It emphasizes independently deployable services, API-first integrations, cloud-native infrastructure and decoupled frontends. In other words, MACH provides the engineering foundation that many composable commerce platforms are built on.
The best approach depends on what problem you're trying to solve:
Headless architecture gives developers complete control over how pages are rendered, but simply decoupling the frontend doesn't make a storefront faster. Performance depends on when HTML is generated, where pages are cached and which rendering strategy is used for each type of page. A poorly implemented client-side application can perform worse for both users and search engines than a well-optimized monolithic storefront.
The four rendering strategies you'll encounter most often are:
The most effective commerce implementations rarely rely on a single rendering strategy. Instead, they match the rendering model to the page's purpose:
This hybrid approach is one of the main reasons Next.js has become the dominant framework for headless commerce. It allows developers to choose the most appropriate rendering strategy on a page-by-page basis, maximizing both performance and flexibility without forcing the entire application into a single rendering model.
Although any framework capable of consuming APIs can power a headless storefront, Next.js has become one of the most popular choices for most commerce projects.
Other than being built on React, the biggest reasons teams choose Next.js include:
That doesn't mean Next.js is the only option. Nuxt offers a similar experience for Vue teams, while Astro continues to gain traction for content-heavy websites. However, neither currently matches the size of Next.js's commerce ecosystem or the number of production-ready integrations available today.
A commerce platform is good for managing products, prices, inventory and orders. However, it is not designed to be a complete content management system. As brands invest more in buying guides, landing pages, editorial content and campaigns, forcing that content into a commerce platform quickly becomes restrictive. That's why many headless commerce architectures pair the commerce backend with a dedicated headless CMS.
Rather than replacing the commerce platform, the CMS becomes a parallel content layer. Each system owns the data it's best suited to manage. The frontend then brings both sources together.
A product page, for example, might combine product information from the commerce platform with promotional banners, FAQs, and buying advice from the CMS before rendering a single page for the customer. Likewise, a category landing page can display curated editorial content alongside dynamically fetched product listings, creating richer shopping experiences without duplicating data across systems.
This separation also benefits the teams maintaining the site. Marketers and content editors can publish campaigns without depending on developers or commerce administrators, while commerce teams continue managing catalogs and pricing independently. Because both systems expose APIs, each can evolve without disrupting the other.
Common headless CMS choices include WordPress, Drupal, Contentful and Storyblok, each serving the same architectural role regardless of the commerce platform behind it.
A successful headless commerce architecture doesn't end with choosing a commerce platform or frontend framework. Once those decisions are made, the focus shifts to operating the stack reliably. That means managing separate codebases, deployment pipelines, environments, caching strategies and team workflows without adding unnecessary operational complexity – and that’s exactly what Pantheon is designed for.
With Pantheon, teams can:
Build your headless commerce experience on Pantheon today and run your Next.js frontend alongside WordPress or Drupal on a single WebOps platform.

Website Performance
With AI changing the unit economics of creating for the web, find out what's next for digital platforms in the post-DXP world.

Headless CMS
Compare headless CMS vs traditional CMS, including architecture, SEO, security, workflows, and when each approach makes the most sense.

Artificial Intelligence
What Cloudflare, Microsoft and Pantheon leaders think about adapting the web for bots, rethinking org structures & preserving brand trust.