Headless Architecture: Decoupling the Front from the Back
Monolithic CMS (WordPress, Shopify Liquid) is limiting. Headless architecture allows you to build a Ferrari engine with a custom body.
The Monolith Constraint
In the old world (WordPress, Magento, Shopify 1.0), the Frontend (The Theme) and the Backend (The Database/Admin) were glued together.
To change the color of a button, you edited a .liquid or .php file inside the CMS structure.
This is convenient for small sites.
It is a prison for ambitious sites.
Constraints:
- Performance: You serve HTML generated by a slow PHP/Ruby server. You cannot use modern Edge Caching easily.
- DX: You can’t use React. You can’t use Hot Module Replacement. You code in a textarea or upload ZIP files.
- URL Structure: You are stuck with
/products/xyz. You can’t change the routing.
The Headless Revolution
Headless means chopping the head (Frontend) off the body (Backend). They talk via API.
- Backend: Shopify / Contentful / Strapi. (Pure Data).
- Frontend: Next.js / Remix / Vue. (Pure UX).
- Connection: GraphQL / REST API.
Now, you can build the Frontend as a high-performance Single Page App (SPA). You can host it on Vercel (Edge Network). You can fetch data from Shopify and Contentful and a custom database, and merge them into one seamless page. The user doesn’t know they are browsing 3 different systems.
Why Maison Code Discusses This
At Maison Code, we specialize in Headless Luxury. Luxury brands need “Storytelling”. They want a Product Page that looks like a Movie Trailer. Standard Shopify Themes cannot do this. They are rigid grids. We use Headless patterns to override the grid. We use Shopify Hydrogen (Remix-based framework) to build custom storefronts that feel like native apps, while keeping the rock-solid Shopify Checkout for payments. We talk about this because Differentiation requires code control.
The Stack: JAMstack 2.0
- Commerce Engine: Shopify Plus or BigCommerce. (Handles Cart, Checkout, Inventory).
- CMS: Contentful or Sanity. (Handles rich text, blog posts, landing page layouts).
- Frontend Framework: Next.js or Remix.
- Hosting: Vercel or Netlify.
The “Composable” Commerce
This allows you to pick the “Best of Breed”. Don’t like the Shopify Blog engine? (It’s terrible). Keep Shopify for products, but swap in Sanity CMS for the blog. Don’t like Shopify Search? Swap in Algolia. In a Monolith, you are stuck with the built-in tools. In Headless, you compose your dream stack.
7. Federated Content (The Mesh)
In a Monolith, all data lives in one SQL database. In Headless, data lives everywhere. We use GraphQL Federation (Stitching).
- Product comes from Shopify.
- Reviews come from Yotpo.
- Editorial comes from Sanity.
- Recommendations come from Rebuy. The Frontend queries one endpoint (The Mesh). The Mesh calls the services in parallel. This is faster than sequential execution and cleaner than spaghetti code in the client.
8. Preview Mode: The Missing Link
Marketers hate Headless because “I can’t see what I’m editing”.
In Shopify Theme Editor, you see changes instantly.
In Headless, you hit “Save” in Contentful, wait 2 mins for build… useless.
Solution: Next.js Preview Mode / Sanity Live Preview.
We build a real-time bridge.
When the Marketer types in Sanity, we use postMessage to update specific DOM nodes in the React app instantly.
It feels like a WYSIWYG editor, but it generates clean React code.
9. Case Study: Custom Product Configurator
Imagine selling a custom Suit. User selects Fabric, Button, Lapel Style, Monogram. There are 10,000 combinations. Shopify Variants supports max 100 variants. Monolith Solution: Impossible. Hacky Apps. Headless Solution: We build a custom React Interface. It holds the state of the selections. It generates a dynamic 3D preview. When the user clicks “Add to Cart”, we create a “Custom Item” via the Shopify API with specific metadata attributes. The Backend doesn’t care about the visual complexity. The Frontend handles it.
The Complexity Tax
Headless is not free. In a Monolith, “Add to Cart” just works. In Headless, you have to write the fetch call, handle the loading state, handle the error state, handle the optimistic UI update. You own the complexity. Trade-off: High functionality requires High Engineering effort. Do NOT go Headless if:
- You have < $1M revenue.
- You don’t have a developer team.
- A standard theme is “Good Enough”.
The Skeptic’s View
“It’s over-engineered. My theme converts fine.” Counter-Point: Themes convert fine for standard goods. But if you want “Instant Page Loads” (Core Web Vitals), Themes struggle. Themes load 50 jQuery plugins. Headless loads exactly the JS you wrote. Speed = Conversion. Headless sites are often 50% faster than Monoliths.
FAQ
Q: What about Checkout?
A: Usually, we keep the Checkout on the platform (e.g., redirect to checkout.shopify.com).
Rebuilding Checkout is risky (PCI Compliance, Tax logic, Shipping rules).
Shopify explicitly discourages custom checkouts unless you are Shopify Plus.
Q: Is SEO harder? A: It used to be (Client-side rendering). With Server Side Rendering (SSR) in Next.js/Remix, it is actually better than Monoliths because you have full control over the metadata and semantic HTML structure.
10. The API Gateway Layer
If you have 10 microservices, your Frontend shouldn’t talk to 10 APIs.
It deals with CORS hell and key management.
We insert a API Gateway (BFF - Backend for Frontend).
Usually a lightweight GraphQL server (Apollo Server or specialized Edge function).
It aggregates the 10 APIs into One Schema.
Frontend: query { product { price, reviews, availability } }.
Gateway: Fetches Price (Shopify), Reviews (Yotpo), Availability (ERP) in parallel.
It simplifies the Client logic drastically.
11. Handling Large Catalog Performance
“We have 100,000 products. Building the static site takes 4 hours.” This is the “Build Time” trap of Gatsby/Next.js SSG. Solution: ISR (Incremental Static Regeneration).
- Build the Top 1000 products at deploy time (Critical path).
- Product 1001 is “Not Built”.
- User visits Product 1001.
- Server builds it on-demand (takes 200ms) and caches it.
- Next user gets the cached version (Instant). This keeps build times fast (5 mins) while supporting infinite catalogs.
12. Conclusion
Headless is the separation of concerns applied to business logic. It frees the Marketing team (using the CMS) and the Engineering team (using React) to move at their own speeds. It is the architecture of the modern web.
Stuck in a Template?
If your brand has outgrown the limitations of standard themes, Maison Code can migrate you to a Headless Architecture.
Outgrown Shopify Themes?
We build Headless Commerce solutions using Next.js/Hydrogen to deliver custom, high-speed shopping experiences. Hire our Architects.