GraphQL has quickly garnered massive adoption among the development community, and most CMSs have adapted in turn. It’s become a crucial aspect of quickly bringing content-driven web apps to market and maximizing the ROI of a headless CMS solution.
While it’s true that most headless CMSs are now offering support for GraphQL, what this exactly means varies greatly from vendor to vendor. That’s because the majority of CMS solutions leverage Apollo for GraphQL functionality. Let’s take a closer look at GraphQL and Apollo, why the third-party platform has some drawbacks for CMSs, and the advantages of a native GraphQL implementation.
How GraphQL Works
GraphQL is a standardized querying language for APIs that is largely driven by schemas. The schema describes how the backend data is structured, whether its a database, Git-repository, e-commerce repository, or another form of datastore. Setting up GraphQL requires a server that maintains an up-to-date schema and resolvers that describe how to actually retrieve this data. Once these are in place, developers can query the server in a standardized way and get back the exact content they’re looking for.
Many CMSs have turned to the Apollo platform as a pre-built execution runtime to handle these tasks, but implementing these requirements directly into the core CMS platform may be a better approach in the long run. Let’s take a closer look at Apollo for GraphQL.
What is Apollo?
Apollo may simplify the GraphQL implementation requirements for CMS vendors, but it’s also an intermediary that can slow performance and limit functionality. That’s because the data from a CMS must first flow through the Apollo server before being served as a GraphQL response. This additional step could be costly from a performance perspective.
Apollo does allow users to extend its functionality with plugins, but this is often clunky and harder to manage. You won’t get granular control of the additional add-ons because the new plugins aren’t directly integrated with the CMS and its built-in services. Instead, these plugins live on the Apollo Server and can only add functionality at this point in the request lifecycle.
Crafter CMS: Native GraphQL Support
GraphQL support with Apollo is good, but it’s not great. That’s because a native implementation of GraphQL brings improved performance, convenient schema management, and better extensibility. Here’s how Crafter CMS offers superior support for GraphQL — as both a server and client — out of the box.
GraphQL is built into the core of Crafter CMS. That means its implementation — the schema, resolvers, and other GraphQL metadata — is fine-tuned to efficiently retrieve and deliver content. The native implementation includes support for advanced GraphQL capabilities like aliases and fragments as well. This low level implementation leads to much lower latency than needing to pass content through a third-party platform first. High-performance APIs are crucial for providing a digital experience that reduces bounce rates and keeps users coming back.
Dynamic Schema Generation
One of the most difficult aspects of working with GraphQL is keeping schemas — the descriptions of your data structures — up to date. With Crafter’s native support for GraphQL, however, the GraphQL schema is generated based on the content types you define in Crafter Studio. This schema is also updated automatically when any changes are detected without any additional effort by developers. Crafter Engine will build the schema based on both the content types configured and any additional Groovy scripts to customize the schema. Dynamic schema generation dramatically streamlines the process of maintaining a GraphQL server.
Since Crafter CMS implements GraphQL directly within the core platform, developers can use many of the same tools to extend its functionality as they would with other REST APIs. That means developers can use lightweight Groovy scripts to work with GraphQL schemas, resolvers, fetchers, filters, and more. This means new services and other features can be attached to GraphQL response, for example, to better integrate with clients. Working with the GraphQL server at a deeper level is a surefire to enable innovative use of the technology.
The Crafter Studio makes it easier to work with GraphQL itself as well. That’s because the CMS interface has a built-in GraphiQL client for creating and testing new GraphQL queries. Developers can use the tool to easily explore the schema documentation for a particular site without using third-party tools. This reduces the development time necessary when integrating a new frontend app or third-party system using GraphQL. Crafter CMS has native support for both a GraphQL server and client to ensure the best developer experience possible.
Choose An Innovation-First CMS
Digital innovation — not digital transformation — is crucial for any brand or organization to remain competitive in 2020. That means choosing a CMS that enables digital agility and adaptability through native support for key technologies and the ability to get functionality to market quickly. GraphQL is seeing massive adoption for a good reason: it streamlines enterprise development and reduces development cycles.
Crafter CMS has doubled-down on digital innovation with native GraphQL out of the box. Most other CMSs with GraphQL support can’t match the speed, convenience, and flexibility of Crafter. The platform doesn’t require third-party tools to extend the capabilities of its GraphQL implementation, and developers are free to use simple Groovy scripts to customize the schema. In addition, developers can use the built-in GraphQL client — GraphiQL — to quickly test new queries during integrations.
Organizations need a CMS that doesn’t just tack on features that the market wants, but deeply integrates high-quality functionality into the core platform. GraphQL is just the start. For an innovation-first CMS, choose Crafter CMS.