GraphQL for Headless CMS: Strapi, Contentful and Magento Compared
AI generated
{ }
type
GraphQL · Headless CMS · Strapi · Contentful · Magento
GraphQL for Headless CMS
Strapi, Contentful, and Magento head to head

Wiring a headless CMS to GraphQL is an architectural decision that shapes content modeling, caching, and team workflows for years. Strapi, Contentful, and Magento GraphQL implement the same specification in fundamentally different ways, with consequences for query complexity, authorization, and where content ends and commerce data begins.

19 min read Strapi · Contentful · Magento · Content Modeling GraphQL · Headless Architecture

1. Why headless CMS and GraphQL fit together

A headless CMS separates content management from presentation, exposing only an API that any frontend can consume. GraphQL fits this model particularly well because different frontends, a marketing landing page, a mobile app, a product catalog, each need different field combinations of the same content model. Instead of maintaining a separate REST endpoint for every use case, each client using GraphQL for headless CMS queries exactly the fields it actually renders.

The second reason lies in the structure of content itself: content models typically consist of nested, reusable components, a blog post references an author, the author references a profile picture, the profile picture references metadata. GraphQL maps such graphs natively, while REST APIs force either deeply nested responses or several sequential requests for the same structure. GraphQL for headless CMS thus reduces both the number of requests and the amount of unused data in the response.

All three platforms compared here, Strapi, Contentful, and Magento, offer GraphQL today as a full alternative to their REST API, but differ fundamentally in how the schema comes into being, who controls it, and how tightly it stays coupled to the underlying data structure.

2. Strapi: GraphQL plugin and schema generation

Strapi is a self-hosted, open source headless CMS built on Node.js. GraphQL is not a core feature but an official plugin that, once installed, automatically generates a complete schema from the content types defined in the admin panel, including queries, mutations, and filters for every type. This automatic generation is the biggest advantage of GraphQL for headless CMS with Strapi: a new field in the content type builder appears in the GraphQL schema instantly, with no manual step.


// config/plugins.js — enable and configure the GraphQL plugin
module.exports = ({ env }) => ({
  graphql: {
    config: {
      endpoint: "/graphql",
      shadowCRUD: true, // auto-generate queries/mutations from content types
      playgroundAlways: env("NODE_ENV") !== "production",
      depthLimit: 10,   // guard against deeply nested malicious queries
      amountLimit: 100,
    },
  },
});

The downside of this automation: because the schema is derived directly from the database structure, it often mirrors internal modeling decisions one to one, resulting in less elegantly named fields than a manually curated schema would have. Strapi does allow adjusting the generated schema through resolver overrides and custom types, but this step is extra effort that Contentful and Magento solve differently in their respective models.

3. Contentful: managed content API with GraphQL

Contentful is a fully managed SaaS service with no self-hosting option. Its GraphQL Content API is not generated from a fixed database schema but is dynamically derived from the content types defined in the Contentful web interface, including automatically generated filter arguments for every field. For GraphQL for headless CMS with Contentful this means editors without a development background can create new fields that are instantly queryable through GraphQL, with no deployment required.


# Contentful auto-generates rich filter arguments per field
query BlogPosts {
  blogPostCollection(
    where: { publishedDate_gte: "2026-01-01" }
    order: publishedDate_DESC
    limit: 10
  ) {
    items {
      title
      slug
      author {
        name
        avatar { url }
      }
      body { json }
    }
  }
}

Because Contentful runs as a pure SaaS service, all infrastructure responsibility disappears, but customizability stays limited: custom resolvers or your own business logic inside the GraphQL layer are not supported, so more complex transformations have to happen in the frontend or through an additional BFF (backend for frontend) layer. This clearly sets Contentful apart from Strapi, where custom resolvers can run directly inside the CMS process.

4. Magento GraphQL: commerce-specific requirements

Magento is not a pure headless CMS but an e-commerce platform with a built-in GraphQL endpoint that covers both commerce entities, products, categories, cart, and CMS blocks and pages. GraphQL for headless CMS use cases meet a completely different starting point in Magento: the schema is not freely modelable, it follows the platform's complex EAV structure (entity attribute value) of the product catalog, extended with custom attributes merchants define in the admin panel.


# Magento GraphQL blends commerce entities and CMS content in one schema
query ProductWithCmsBlock($sku: String!) {
  products(filter: { sku: { eq: $sku } }) {
    items {
      name
      sku
      price_range {
        minimum_price { final_price { value currency } }
      }
      # Custom EAV attribute defined by merchant in admin panel
      material
    }
  }
  cmsBlocks(identifiers: ["product_page_trust_badges"]) {
    items { identifier content }
  }
}

The decisive difference from Strapi and Contentful: in Magento GraphQL, content is never fully decoupled from commerce logic. Prices, stock levels, and tax rules flow into the same resolvers that also serve pure content fields, which makes performance optimization more demanding than with a pure content store. Teams using GraphQL for headless CMS in a Magento context usually combine it in practice with a separate content system like Strapi or Contentful for editorial content, while Magento GraphQL stays responsible for product data.

5. Content modeling: components, content types, and EAV

The three platforms model content in fundamentally different ways. Strapi distinguishes between collection types (recurring entries like blog posts) and single types (one-off pages like a homepage), extended with reusable components that can be embedded in multiple content types. Contentful only knows content types with fields, nested structures emerge through reference fields pointing to other entries, which can become more flexible but also less structured without clear team conventions.

Magento's EAV model, in turn, originated historically for product catalogs with strongly varying attribute sets, a shoe needs different attributes than a piece of furniture, and was never designed for general content modeling. This shows up directly in the GraphQL schema: Magento fields like configurable_options or price_range have no equivalent in Strapi or Contentful because no commerce concept exists there at all. When choosing GraphQL for headless CMS, the platform's modeling philosophy should therefore match the actual content type, editorial content and product data have fundamentally different requirements.

6. Caching strategies per platform

Caching behavior differs sharply across the three platforms. Strapi ships with no built-in response cache by default, teams must add their own caching layer, for example through Redis or a CDN with GraphQL persisted queries. Contentful runs a global CDN as a SaaS service and caches GraphQL responses automatically, though with an invalidation delay of a few seconds up to a minute after a content change.


{
  "cacheStrategy": {
    "strapi": "no cache out of the box, add Redis/CDN manually",
    "contentful": "global CDN, automatic invalidation with a short delay",
    "magento": "Varnish full-page cache for pages, GraphQL layer separately via Redis"
  }
}

Magento typically combines Redis for session and configuration data with a separate caching layer for expensive resolvers, for instance price calculations involving tax rules, at the GraphQL layer. Because Magento GraphQL responses can be heavily personalized, logged-in customers see different prices than guests, naive full-response caching like Contentful's is not applicable here, caching instead happens at a more granular field and resolver level.

7. Authentication and role concepts compared

Strapi implements authentication through roles and permissions configured directly in the admin panel per content type and per GraphQL operation, using JWT tokens by default. Contentful strictly separates a writable management token for editors from a separate, usually publicly embedded read-only token for the GraphQL content API, which structurally rules out accidental write access through the content API.

Magento GraphQL uses customer tokens for authenticated requests, requested through a dedicated mutation, combined with a separate integration token system for server-side access, for example from a Next.js backend. This three-way split, customer token, integration token, and public store-view access without a token, is noticeably more granular than Contentful's two-token logic, but also reflects the higher complexity of a commerce system handling personal order data. Anyone planning GraphQL for headless CMS with personalized content should factor these differences into the architecture early.

8. Query performance in practice

Performance characteristics differ significantly. Strapi resolvers run in the same Node process as the CMS and therefore have very low latency for simple queries, but scale worse with deeply nested queries across many relations unless a DataLoader batching strategy is implemented. Contentful's distributed SaaS infrastructure delivers consistently low latency through CDN edge nodes regardless of the requesting client's location, but loses this advantage for heavily personalized or uncached queries.

Magento GraphQL shows the widest variance: plain catalog queries against cached category data are fast, while resolvers involving price calculation, multi-website stock checks, and personalized discounts get noticeably slower because they compute against the platform's business logic in real time. For all three platforms, when it comes to GraphQL for headless CMS, query depth and the number of resolved relations determine latency far more than the raw amount of content.

9. Strapi, Contentful, and Magento head to head

In practice, many teams don't settle on a single platform but build a BFF layer (backend for frontend) that merges several GraphQL sources into a single interface for the frontend. Such a BFF layer queries Strapi or Contentful for editorial content, Magento GraphQL for product data, and hands the client one unified, combined schema, without the frontend itself having to configure multiple GraphQL clients.


# BFF layer schema stitching Strapi content and Magento commerce data
type ProductLandingPage {
  # Resolved from Strapi: editorial hero content and marketing copy
  heroContent: StrapiHeroBlock!
  # Resolved from Magento GraphQL: live price and stock information
  featuredProducts: [MagentoProduct!]!
}

extend type Query {
  productLandingPage(slug: String!): ProductLandingPage
}

This approach to GraphQL for headless CMS has a decisive advantage: each platform stays responsible for what it was actually designed for, Strapi or Contentful for editorial flexibility, Magento GraphQL for correct, real-time-calculated commerce data. The BFF layer itself carries the complexity of merging, so neither the content system has to replicate commerce logic nor Magento has to simulate editorial freedom. The table below summarizes the key differences as a decision basis for choosing a platform for a new headless project.

Criterion Strapi Contentful Magento GraphQL
Hosting Self-hosted, open source Managed SaaS Self-hosted / cloud
Focus Editorial content Editorial content Commerce + CMS blocks
Custom resolvers Yes, directly in the CMS process No, only via external BFF layer Yes, via PHP modules
Caching out of the box No, add it manually Yes, global CDN Partially, Varnish + Redis required
Ideal for Custom content models with code control Editorial teams without DevOps resources Product catalogs with a content component

Migration path: from Magento-only to content plus commerce

  1. Inventory existing CMS blocks and pages in Magento and rate them by editorial change frequency
  2. Gradually migrate frequently changed marketing content to Strapi or Contentful
  3. Introduce a BFF layer that merges both GraphQL sources for the frontend
  4. Keep Magento GraphQL responsible exclusively for product catalog, cart, and checkout

Mironsoft

Headless architecture, Magento GraphQL, and CMS integration

Finding the right headless CMS for your GraphQL setup?

We advise on choosing between Strapi, Contentful, and Magento GraphQL and build the right content and commerce architecture for your frontend, whether React, Next.js, or Hyvä.

Platform selection

Requirements analysis and a recommendation for Strapi, Contentful, or Magento

Magento GraphQL

Custom resolvers, custom attributes, and CMS block integration

Content + commerce

Two-system architectures with a clean split between content and product data

10. Summary

GraphQL for headless CMS means three fundamentally different architectures under the same query language when comparing Strapi, Contentful, and Magento. Strapi offers full code control at the cost of running your own infrastructure, Contentful delivers a maintenance-free SaaS solution with limited customizability, Magento GraphQL merges content with complex commerce logic and fits best where product data sits at the center. The choice depends less on GraphQL itself, which fulfils the same specification in all three cases, and more on who maintains the content, how tightly it interlocks with business logic, and what operational resources the team has.

In practice, hybrid architectures are common: Magento GraphQL stays responsible for product catalog, cart, and checkout, while Strapi or Contentful serve editorial landing pages, blog content, and marketing campaigns. A shared BFF layer can merge both GraphQL endpoints for the frontend without Strapi or Contentful ever having to take on commerce logic.

GraphQL for Headless CMS — The key facts at a glance

Strapi

Self-hosted, full code control over resolvers, no caching out of the box.

Contentful

Managed SaaS with global CDN caching, no custom resolver capability.

Magento GraphQL

Commerce and CMS blocks in one schema, complex EAV-based data structure.

Hybrid architecture

Run a content CMS and Magento GraphQL side by side, unify them through a frontend BFF layer.

11. FAQ: GraphQL for Headless CMS

1What does GraphQL for headless CMS mean?
Each client queries exactly the fields it needs from a nested content model, instead of rigid, fixed-structure REST responses.
2Strapi and Magento GraphQL together?
Yes, common pattern: content in Strapi/Contentful, product data in Magento GraphQL, both queried from the same frontend.
3Why no custom resolvers in Contentful?
Contentful is multi-tenant SaaS, custom server code would jeopardize the infrastructure, so complex logic runs externally.
4Is Strapi's schema always current?
Yes, with shadowCRUD, Strapi auto-generates queries and mutations from every content type in the admin panel.
5How does Magento differ from a pure CMS?
Magento GraphQL delivers commerce entities with real-time business rules, something content-only platforms cannot represent.
6Best platform for editorial teams?
Contentful, because no server operation is needed and the interface is built directly for editors.
7Personalized prices in the cache?
In Magento, personalized fields are cached separately or excluded entirely, static product data can be cached normally.
8Content preview in Strapi?
Yes, via draft-and-publish with a separate preview endpoint before public release.
9Learning curve Magento vs. Strapi?
Considerably steeper for Magento due to EAV and service contracts, Strapi generates a simpler schema.
10Magento for a pure content project?
Usually not worth it, without commerce focus Strapi or Contentful are leaner and faster to set up.