Este artigo está atualmente disponível apenas em inglês. Tradução em breve.
Parte da nossa série eCommerce Integration
Leia o guia completoHeadless Commerce Architecture: Decoupling Frontend from Backend
Traditional eCommerce platforms bundle the storefront (what customers see) with the back-end (inventory, orders, payments). This coupling made sense when the only storefront was a desktop website. Today, commerce happens on mobile apps, voice assistants, IoT devices, social platforms, kiosks, and progressive web apps. A monolithic platform cannot serve all of these touchpoints without compromise.
Headless commerce decouples the frontend presentation layer from the backend commerce engine, connecting them through APIs. The backend handles catalog, cart, checkout, payments, and fulfillment. The frontend is free to be anything — a blazing-fast Next.js site, a React Native mobile app, a voice skill, or all three simultaneously.
Key Takeaways
- Headless architecture trades simplicity for flexibility — it is not the right choice for every business
- API-first design enables multiple frontends (web, mobile, IoT) from a single commerce backend
- Next.js and Remix have emerged as the dominant frontend frameworks for headless storefronts
- The total cost of headless is higher than monolithic, but the performance and customization gains justify it for brands above $5M in annual revenue
Headless vs Monolithic: Architecture Comparison
Understanding the fundamental differences helps you decide whether headless is right for your business.
| Dimension | Monolithic (Traditional) | Headless (Decoupled) | |----------|------------------------|---------------------| | Frontend | Bundled templates/themes | Independent application(s) | | Backend | Tightly coupled to frontend | API-only, frontend-agnostic | | Deployment | Single deploy for everything | Independent frontend and backend deploys | | Performance | Theme/plugin dependent | Full control (SSR, SSG, ISR, edge caching) | | Customization | Limited by platform theme system | Unlimited (custom code) | | Time to market | Fast (install theme, go) | Slower (build frontend from scratch) | | Developer experience | Platform-specific (Liquid, PHP) | Modern frameworks (React, Vue, Svelte) | | Hosting | Platform-managed | Self-managed or edge (Vercel, Netlify) | | SEO control | Template-limited | Full control over rendering and metadata | | Cost (build) | $5K-$30K | $30K-$150K | | Cost (maintain) | $500-$2K/mo | $2K-$10K/mo | | Best for | SMBs under $5M revenue | Brands above $5M, custom experiences |
When Monolithic Wins
For businesses that need to launch quickly, have a small development team, and sell primarily through a standard web storefront, monolithic platforms like Shopify (with a standard theme) or WooCommerce are pragmatic choices. The constraints of a theme system are acceptable when speed and cost matter more than customization.
When Headless Wins
Headless becomes the better choice when you need:
- Sub-second page loads: Static generation and edge caching achieve performance that no server-rendered monolith can match
- Multiple touchpoints: Web, mobile app, and in-store kiosk all need commerce capabilities
- Custom checkout flows: Subscription models, B2B pricing, bundled products, or multi-step configurators that monolithic checkout cannot support
- Brand differentiation: Your competitor's Shopify store looks like yours because you use the same theme engine. Headless lets you build something distinctive.
- Content-driven commerce: Editorial content, lookbooks, and product stories blended seamlessly with commerce — not a blog bolted onto a store
API-First Design Principles
The API layer is the contract between your commerce backend and your frontends. Get this right and your architecture scales. Get it wrong and you have a distributed monolith — all the complexity of headless with none of the benefits.
API Design for Commerce
A commerce API needs to support these core operations:
- Catalog: Browse products, search, filter by attributes, retrieve product details with variants
- Cart: Create cart, add/remove items, apply discounts, calculate totals with taxes and shipping
- Checkout: Collect shipping info, select shipping method, process payment, create order
- Customer: Register, login, view order history, manage addresses, save payment methods
- Content: Pages, blog posts, navigation menus, banners — editorial content that drives commerce
GraphQL vs REST
| Aspect | REST | GraphQL | |--------|------|---------| | Data fetching | Fixed response shapes, may over-fetch | Client specifies exact fields needed | | Caching | HTTP caching works naturally (CDN, browser) | Requires custom caching strategy | | Versioning | URL versioning (/v1/, /v2/) | Schema evolution, no versioning needed | | Tooling | Mature, universal | Growing, requires schema management | | Performance | Multiple requests for related data | Single request for complex queries | | Learning curve | Low | Medium | | Best for | Simple CRUD, cacheable resources | Complex data relationships, mobile apps |
Shopify's Storefront API uses GraphQL, and for good reason — a product page needs product data, variant data, images, reviews, and related products. In REST, that is 5 API calls. In GraphQL, it is one query that returns exactly the fields your component needs.
API Gateway
An API gateway sits between your frontends and your backend services, providing:
- Authentication: Token validation, rate limiting, API key management
- Routing: Direct requests to the appropriate backend service
- Caching: Cache read-heavy endpoints (product catalog) at the gateway level
- Transformation: Adapt backend responses for frontend consumption
- Monitoring: Track latency, error rates, and usage per endpoint
Commerce Backend Options
The headless backend you choose determines your commerce capabilities, API quality, and total cost.
| Platform | Type | API Style | Pricing | Hosting | Best For | |---------|------|----------|---------|---------|----------| | Shopify Storefront API | SaaS | GraphQL | Shopify plan + API access | Shopify-managed | Shopify ecosystem, proven scale | | Medusa.js | Open source | REST + Events | Free (self-hosted) | Self-hosted | Full control, Node.js stack | | Saleor | Open source | GraphQL | Free (self-hosted) or cloud | Self-hosted or Saleor Cloud | GraphQL-first, Python/Django stack | | commercetools | Enterprise SaaS | REST + GraphQL | Usage-based ($2K+/mo) | Managed | Enterprise, global scale | | BigCommerce | SaaS | REST + GraphQL | Plan-based ($29+/mo) | Managed | Mid-market, built-in features | | Elastic Path | Enterprise SaaS | REST | Custom pricing | Managed | Complex B2B, composable commerce | | Odoo eCommerce API | Open source | REST + XML-RPC | Free (self-hosted) or Odoo.sh | Self-hosted or Odoo.sh | ERP-integrated commerce |
Shopify Storefront API Deep Dive
Shopify's Storefront API is the most popular headless commerce API. It provides:
- Product catalog: Full product and collection queries with metafields
- Cart: Server-side cart management with automatic tax and shipping calculation
- Checkout: Redirect to Shopify checkout or use Checkout API (Plus only)
- Customer: Account creation, login, order history
- Content: Pages, blogs, and navigation via the API
Shopify Hydrogen (their React framework) and the Storefront API together provide a polished headless experience. The limitation is checkout — on non-Plus plans, checkout must redirect to Shopify's hosted checkout page, breaking the fully custom experience.
Open Source: Medusa.js
Medusa.js is a Node.js/TypeScript open-source commerce engine that has gained significant traction. It provides:
- Modular architecture with plugins for payments, fulfillment, and notifications
- Event-driven backend with subscriber pattern
- Multi-region and multi-currency support
- Admin dashboard included
- Full control over every aspect of the commerce flow
For teams already running a Node.js stack (like ECOSIRE's NestJS backend), Medusa integrates naturally without introducing a new language or framework.
Frontend Frameworks for Headless Commerce
The frontend is where headless commerce delivers its biggest advantage: complete control over performance, design, and user experience.
Framework Comparison
| Framework | Rendering | Performance | DX | Commerce Ecosystem | Learning Curve | |----------|----------|------------|-----|-------------------|---------------| | Next.js (App Router) | SSR, SSG, ISR, RSC | Excellent | Excellent | Shopify Hydrogen alt, Medusa starter | Medium | | Remix | SSR, progressive enhancement | Excellent | Excellent | Growing | Medium | | Astro | Static-first, islands | Best (minimal JS) | Good | Limited | Low | | Nuxt (Vue) | SSR, SSG | Very Good | Good | Vue Storefront | Medium | | SvelteKit | SSR, SSG | Excellent | Excellent | Limited | Medium | | Shopify Hydrogen | SSR (Remix-based) | Excellent | Good | Shopify-native | Medium |
Next.js as the Default Choice
Next.js dominates headless commerce frontends for good reasons:
- React Server Components: Fetch data on the server, stream HTML to the client, zero JavaScript for static content
- Incremental Static Regeneration: Static pages that revalidate in the background — static performance with dynamic data
- Edge middleware: Run logic at the CDN edge for personalization, A/B testing, and geolocation
- Image optimization: Built-in next/image with automatic WebP/AVIF conversion, lazy loading, and responsive sizing
- Vercel deployment: One-click deploy with automatic preview URLs for every pull request
A Next.js headless storefront typically achieves:
- Lighthouse Performance: 95-100 (vs 60-80 for monolithic Shopify themes)
- Largest Contentful Paint: Under 1.5 seconds (vs 3-5 seconds)
- Time to Interactive: Under 2 seconds (vs 5-8 seconds)
- Core Web Vitals: All green in Google Search Console
Starter Templates
Most headless commerce platforms provide Next.js starter templates:
- Shopify:
create-hydrogen-app(Remix-based) ornext-shopify-starter(community) - Medusa:
medusa-nextjs-starter(official) - Saleor:
saleor-storefront(official, Next.js + GraphQL) - commercetools:
commercetools-frontend(official)
These starters accelerate development by providing pre-built pages (product listing, product detail, cart, checkout, account) that you customize rather than build from scratch.
Content and Commerce Integration
Headless commerce enables a content-first approach where editorial content and commerce blend seamlessly. A blog post about "10 Best Running Shoes for Flat Feet" can embed shoppable product cards inline. A lookbook page transitions naturally into a product detail page.
Content Management Options
| CMS | Type | Pricing | Commerce Integration | Best For | |-----|------|---------|---------------------|----------| | Sanity | Headless | Free tier, then usage-based | Custom schemas | Structured content, real-time editing | | Contentful | Headless | Free tier, $300+/mo | App framework | Enterprise content operations | | Strapi | Open source | Free (self-hosted) | REST/GraphQL API | Developer-controlled content | | Storyblok | Headless | Free tier, $106+/mo | Visual editor + API | Visual editing, non-technical teams | | MDX (filesystem) | File-based | Free | Compile-time | Developer blogs, documentation |
For ECOSIRE's stack, MDX files managed in the codebase (as used on ecosire.com's blog) combine with Odoo's product data to deliver content-driven commerce without adding another SaaS dependency.
Unified Data Layer
The frontend needs to merge data from multiple sources — product data from the commerce API, editorial content from the CMS, user data from the auth system, and analytics from the data platform. A unified data layer (implemented as React context providers or a state management library) combines these sources into a coherent data model that components consume.
Performance Optimization
Performance is the primary reason to go headless. A monolithic Shopify store on a standard theme loads in 3-5 seconds. A well-built headless storefront loads in under 1.5 seconds. That difference converts directly into revenue — every 100ms of load time reduction increases conversion rate by 1%.
Caching Strategy
| Layer | Technology | TTL | Content | |-------|-----------|-----|---------| | CDN edge | Vercel Edge Network, Cloudflare | 60 seconds | HTML pages, images | | API gateway | Redis, Varnish | 30-300 seconds | Product catalog, collection pages | | Browser | Cache-Control headers | Varies | Static assets (JS, CSS, fonts) | | Application | React Server Components cache | Varies (ISR) | Pre-rendered pages |
Image Optimization
Product images are typically the heaviest resources on eCommerce pages. Headless gives you full control:
- Format: Serve WebP to Chrome/Firefox, AVIF to Safari 16+, JPEG/PNG fallback
- Sizing: Generate responsive sizes (320, 640, 960, 1280, 1920 pixels) at build time
- Lazy loading: Load images below the fold only when the user scrolls near them
- CDN delivery: Serve images from the nearest edge location (Cloudflare, Imgix, or Shopify's CDN)
- Placeholder: Show a blurred low-resolution placeholder while the full image loads (blur hash)
Migration Path: Monolithic to Headless
Going headless does not require a big-bang rewrite. A phased migration reduces risk and delivers value incrementally.
Phase 1: API Enablement (Weeks 1-4)
Enable API access on your existing platform. If you are on Shopify, activate the Storefront API. If you are on WooCommerce, ensure the REST API is configured. Do not change the frontend yet — just verify that your backend data is accessible via API.
Phase 2: Content Pages First (Weeks 5-8)
Build your first headless pages for non-commerce content: About, Blog, Contact, FAQ. Deploy alongside your existing store. This builds team familiarity with the frontend framework without touching the critical commerce flow.
Phase 3: Product Pages (Weeks 9-14)
Migrate product listing and product detail pages to the headless frontend. Keep cart and checkout on the monolithic platform. This is the highest-impact phase for performance (product pages are the heaviest) and the lowest risk (checkout still works the way it always has).
Phase 4: Cart and Checkout (Weeks 15-20)
Finally, migrate cart and checkout. This is the riskiest phase because checkout directly affects revenue. Test extensively, run A/B tests between old and new checkout, and monitor conversion rates daily. For Shopify, this phase may mean staying on Shopify's hosted checkout (which is fine — it converts well).
For the complete multi-channel integration that feeds your headless storefront, see the pillar post: The Ultimate eCommerce Integration Guide.
Frequently Asked Questions
Is headless commerce right for a business doing under $1M in revenue?
Probably not. The development and maintenance costs of headless ($30K-$150K build, $2K-$10K/month ongoing) are hard to justify below $1M revenue. Use a monolithic platform (Shopify, WooCommerce) and invest the saved budget in marketing and product. Consider headless when your revenue exceeds $5M and your growth is constrained by platform limitations.
Can I use Shopify as a headless backend and still use Shopify apps?
Some Shopify apps work with headless setups; many do not. Apps that modify the storefront theme (pop-ups, reviews widgets, upsell banners) will not work because the headless frontend does not render Shopify's theme. Apps that operate on the backend (inventory management, shipping, analytics) continue to work. Check each app's API/webhook capabilities before committing to headless.
How do I handle SEO with a headless storefront?
Server-side rendering (SSR) or static generation (SSG) in Next.js ensures that search engines see fully rendered HTML with metadata, structured data, and content — no JavaScript execution required. Implement generateMetadata() for dynamic meta tags, add JSON-LD structured data (Product, BreadcrumbList, FAQPage), and generate an XML sitemap. Headless storefronts typically achieve better SEO performance than monolithic stores because of faster load times and full control over metadata. For implementation details, see how ECOSIRE handles multilingual SEO across 11 locales.
What is the difference between headless and composable commerce?
Headless decouples the frontend from the backend. Composable commerce takes this further — every capability (search, checkout, CMS, PIM, OMS) is a separate, interchangeable service connected via APIs. Headless is a subset of composable. Most mid-market businesses start with headless (decoupled frontend) and evolve toward composable (decoupled everything) as needs grow.
How do I handle checkout without Shopify Plus?
On standard Shopify plans, you can build a custom cart experience but must redirect to Shopify's hosted checkout for payment processing. This redirect creates a slight experience gap but Shopify's checkout has extremely high conversion rates (they have optimized it for millions of stores). For many brands, a custom storefront with Shopify checkout is the pragmatic sweet spot — custom experience where it matters (browsing, discovery) and proven conversion where it counts (payment).
What Is Next
Headless commerce is not a destination — it is an architecture that enables continuous evolution of your customer experience. The brands that win are those who iterate on their storefront weekly, test new experiences, and optimize relentlessly. Headless gives you the freedom to do that without being constrained by a theme system's limitations.
Whether you are evaluating headless for the first time or migrating from a monolithic platform, the architecture decisions you make now will determine your technical agility for years to come.
Explore ECOSIRE's integration services to connect your headless frontend to Odoo's commerce and ERP backend, or contact our team for a headless commerce architecture assessment.
Published by ECOSIRE — helping businesses scale with AI-powered solutions across Odoo ERP, Shopify eCommerce, and OpenClaw AI.
Escrito por
ECOSIRE Research and Development Team
Construindo produtos digitais de nível empresarial na ECOSIRE. Compartilhando insights sobre integrações Odoo, automação de e-commerce e soluções de negócios com IA.
Artigos Relacionados
API Performance: Rate Limiting, Pagination & Async Processing
Build high-performance APIs with rate limiting algorithms, cursor-based pagination, async job queues, and response compression best practices.
Building B2B Buyer Portals with Odoo: Self-Service Ordering & Reorders
Step-by-step guide to building B2B buyer portals in Odoo with self-service ordering, reorders, invoice access, and RFQ submission for wholesale operations.
The B2B eCommerce Playbook: Portals, Pricing Engines & Approval Workflows
Complete B2B eCommerce guide covering buyer portals, pricing engines, approval workflows, contract management, and ERP integration for wholesale operations.
Mais de eCommerce Integration
Data Mapping & Transformation: Handling Different APIs & Data Formats
Master field mapping, data normalization, unit conversion, currency handling, and category taxonomy mapping across eCommerce APIs and data formats.
Multi-Channel Order Routing: Intelligent Fulfillment from Any Warehouse
Implement intelligent order routing with proximity-based, cost-optimized, and capacity-aware fulfillment rules for multi-channel eCommerce operations.
Product Information Management: Consistent Catalog Across 10+ Channels
Build a PIM strategy for multi-channel eCommerce with data modeling, enrichment workflows, and automated syndication to marketplaces and storefronts.
Real-Time Inventory Sync Architecture: Webhooks, Queues & Conflict Resolution
Design event-driven inventory sync with webhooks, message queues, idempotency patterns, and conflict resolution strategies for multi-channel eCommerce.
Returns & Refunds Across Channels: Unified Reverse Logistics
Build a unified returns management system across marketplaces with RMA workflows, automated refunds, restocking logic, and return rate benchmarks.