What is GraphQL?
GraphQL has increased in popularity recently as a modern, efficient, and easy to use API protocol. GraphQL by definition is a query language for APIs and a server side runtime for fulling those queries with your existing data.It was initially developed by Facebook in 2012 to address specifically iOS and Android application performance and reliability problems created by the complexity of Facebook’s mobile apps.
However, today due to GraphQL’s precision of providing a simple an understandable description fo the data in your API, it has granted clients the power to get the exact data they request and nothing more. This in turn has also allowed APIs to evolve more over time and has also enabled powerful developer tools As a query language, it allows commerce developers to efficiently fetch the information needed to deliver customer experiences.
What is GraphQL for eCommerce?
The use of GraphQL for eCommerce has been beneficial specially for businesses which have adopted a Headless Commerce architecture. Due to the decoupling of the frontend presentation layer from the backend commerce engine, the frontend is heavily dependent of the correct data transfer to the frontend. GraphQL fosters seamless data retrieval on the front-end allow businesses to build more unique experiences. Explore more benefits of GraphQL.
What are the Top Benefits of GraphQL?
Simplified Frontend Development
Eliminate the hassle of chasing down up-to-date APIS, and accelerate time to market for new experiences
Code Bloat Reduction
Reduce code duplication across the frontend and the backend and eliminate channel silos that lead to inconsistent customer experiences.
Minimize over and under-fetching, and improve network performance that impacts overall customer experience.
Do I Need GraphQL for My eCommerce Solution?
GraphQL and REST are both API design architectures which can be used to build web services for data driven applications. Overall, Rest and GraphQL are very similar, however GraphQL has made some small changes that alter the developer experience of building and consuming an API.
In addition, GraphQL can be very beneficial in complex circumstances for example, when there are a 1000+ endpoints working in your backend, your frontend developers need a system where they can easily call on specific resources in the backend. Facebook is a great example of business that would greatly benefit from GraphQL. However, for most eCommerce businesses, it’s highly unlikely that it will get to that level of that complexity and GraphQL is NOT needed.
Elastic Path primarily leverages REST rather than GraphQL. Elastic Path was developed to be developer-first centric and thus, we have designed our APIs with developers in mind. We provide RESTful APIs for developers to learn and use, which eliminate complexity while also providing maximum flexibility.
At the end of the day both REST and GraphQL can achieve the same end results, and it will all come down to preference.
At Elastic Path you can choose to adopt REST or leverage Elastic Path GraphQL starter kit
Yes. Elastic Path recently released GraphQL Server for Elastic Path Commerce Cloud which provides a GraphQL implementation of Elastic Path Commerce Cloud APIs to support shopping experiences. This release enables developers more familiar with GraphQL, as compared to REST, to more easily build shopping experiences.
In our experience you can do almost anything with both REST and GraphQL. There are some technical differences, but nothing that's a roadblock in achieving a business goal. The choice between REST and GraphQL comes down to preference.
If you already have frontend developers, and they prefer to use query languages and they only have the technical skill sets to use GraphQL, then GraphQL will be a good choice. However, this answer will change from use case to case based on a few different characteristics:
How many brands you support
How many channels you support
The type of frontend developers you work with (existing or new)
Skillsets of the backend / infrastructure team
What other systems do you have to integrate with
By answering the questions above our technical team can better help you to make the right decision for your business.
Your development team will be responsible for handing all of your code base for the frontend and the backend. Each developer has learned one, or many, code languages to help your system talk to each other. Essentially, each developer would prefer to use a code language that they are most comfortable using. For example, we can all agree english is one of the most universal languages and many people learn how to speak it. However, there are very specific nuances and can oftentimes be difficult for a non-native speaker. Someone who is a non-native speaker would prefer to speak in their native language, solely due to preference. This same goes for choosing between GraphQL and RESTful APIs.
GraphQL is useful when a prospect wants to, or already hosts, GraphQL and they want to work with multiple systems from multiple vendors. It makes life easier for the prospect’s frontend developers by combining all the different data sources into one uniform API and allows all the business logic to be in one place.
However, it becomes less useful if you aren’t the host, and you come across a commerce vendor that offers a GraphQL API. In this instance, it does not make it easier for a customer to work with multiple vendors, especially if other vendors are leveraging REST. In this case, GraphQL would be “useless”. Our team can help you to understand and make an informed decision by discussing your
REST APIs have been around for 40 years and have become industry standard for companies deploying APIs and thus very familiar across vendors
REST endpoints are mature and can be extended and integrated well and easily
API analytics are easier to obtain for REST due to the limited amount of tooling for GraphQL
You can achieve the same results with REST as you would the GraphQL
There can still be a larger learning curve for working with GraphQL
See the Power of Elastic Path Software With a Free Trial
Request access to our revamped Elastic Path Commerce Cloud trial experience. You'll discover first-hand how our composable, headless commerce microservices solution will help you: