How Much Reach Can a GraphQL API Have Over Other APIs?
Certain hyped-up tools, processes and platforms in the software world come and go. But there are some that we can reasonably assume, based on their adoption and merits, will continue to become a mainstay in software process, development and operations tools in the near to possible long term. Many of these technologies will likely fall under the observability, security and API category. In the API space, much work and improvement needs to be made to make them easier to use and manage, and especially, to become more applicable across the widespread spectrum of needs for backend and frontend application development and database management. To that end, GraphQL merits at least a second.
GraphQL is defined as a query language for APIs, and a server-side runtime for executing queries using a type system you define for data, according to GraphQL documentation. Its creators also emphasize how GraphQL isn’t tied to any specific database or storage engine and is instead backed by your existing code and data. Among its benefits, GraphQL data can be loaded with a single request, without having to access several different URLs, which remains the case with REST APIs.
Hasura’s annual user’s conference HasuraCon’22 held last week, ostensibly about GraphQL, while many of the talks covered the gamut of new support Hasura offers for GraphQL. The themes covered and discussed how GaphicQL has evolved and what we can expect to see in the future.
With Hasura’s new Hasura GraphQL Data Connector (GDC) SDK announced during the conference, Hasura says GraphQL users can now connect to “all types of data” sources. Hasura Cloud Enterprise is now available on AWS Marketplace and on Google Cloud Platform, the company announced.
While extending automation and compablitty across more cloud environments for GraphQL is noteworthy, a few conference talks were geared towards real-world applications from a user’s perspective and how a Hasura layer with GraphQL can offer some interesting real-world benefits. These features are described in the talks as not only being useful for the backend and frontend developer, as well as for those users who are able to rely on Hasura’s arguably low-code features to analyze and pool together various and disparate data source analysis through GraphQL’s single API (more on that below).
In the keynote, Hasura CEO Tanmai Gopal did a good job of describing the context of a data API integrated with the different data endpoints that are shared with an organization and the edge, which he defines as the end-user interactions and experience of an application or logic that relies on a data endpoint or endpoints to run. This simple concept also represents an increasing amount of complexity for the developer to create “an amazing product experience at the edge.” The data endpoints, edge use case and the API in the middle “is highly concurrent” Gopal said.
These “highly concurrent” data endpoints, edge use cases and API trifecta can also provide the underlying framework for business cases. “How we transact with centralized and shared data and how shared data is transacted across multiple users is how we think about the product experience. That’s the way our end users are consuming the product, whether the product is an app or an API,” Gopal said. “What we don’t want to focus on is this undifferentiated heavy lifting that we have to do [between the data endpoints and edge-use case] — that’s where the data API comes in.”
Hasura’s new releases announced at the conference reflect the company’s GraphQL API-centric, highly automated and simplified vision of data-driven application delivery. According to Hasura documentation, Hasura’s GDC specification and SDK allows developers to extend Hasura’s GraphQL API capabilities without waiting for Hasura to natively support their data sources. While Hasura previously helped to extend GraphQL to multiple data sources without requiring plugins, its reach now includes more proprietary or legacy data sources.
“We are on a mission to improve access, so we need to go where the data is as we continue to expand our API to more data sources,” Tirumarai Selvan, product manager at Hasura, said during a talk.
@HasuraHQ's Praveen Durairaju gave a great talk and demo this week about creating and federating data across Hasura's updated GraphQL API that it says allows "any data source" to be used with its GraphQL API. The talk is still accessible. https://t.co/gZbG5xv5uW #hasuracon pic.twitter.com/j1jPSwBvpn
— BC Gain (@bcamerongain) July 1, 2022
This ability to federate data that is accessible with a single GraphQL API has several implications. By being able to access and connect different databases that are “not the same flavor,” it is thus possible to combine PostgresQL and SQL Server databases that the Hasura interface for GraphQL can access, Praveen Durairaju, developer-advocacy content manager, for Hasura said. There are many use cases that show how easy the functionality is to use “without actually modifying any of the underlying code,” Durairaju said.
With the Join feature, it is possible to combine data between two independent GraphQL servers. With a common identifier, such as a user ID, Hasura now makes it possible to declaratively configure a relationship between the two servers and the ability to initiate queries to fetch data between the two servers. It is thus possible to join data from a GraphQL server to a database table “and vice versa,” Durairaju said.
Other benefits Hasura communicated include:
- Streaming Subscriptions API to allow users to build apps for streaming data to their clients in batches and updating data in real-time.
- Event Triggers Support for MS SQL Server, allowing users to connect business logic APIs with Hasura to integrate asynchronous backend logic into their applications by calling webhooks on table events such as insert/update/delete for SQL Server data sources.
Hasura will continue to expand its cloud reach as well. Following Hasura’s availability on AWS Marketplace and on Google Cloud, databases on other cloud provider services will soon be available. While Vaishnavi G V S, a Hasura product manager, did not come out and say databases on Microsoft Azure will soon become accessible with Hasura, she said “we’re going to be looking at supporting more cloud providers and expanding to more regions and will also have more integrations and improvements…for cloud enterprise customers.”
You Can Say ‘Low Code’
Much of what Hasura facilitates with GraphQL is for non-engineers and even citizen developers to take advantage of the GraphQL API for database analysis, and even backend development in some cases.
Oftentimes, a backend developer will configure the GraphQL so that a non-technical user can use the API to render database searches and meta-analyses much simpler to initiate. Reporters at the Marshall Project, a non-partisan and non-profit journalism project, which was created to sustain a sense of national urgency in the U.S. criminal justice system, is an example. There, reporters rely on Hasura, GraphQL and other tools to fact-check and gather information and data for articles that would otherwise involve hundreds of hours (or even days) for articles involving multiple data sources.
Marshal Project reporters, for example, heavily rely on the Hasura interface, GraphQL and other database tools to assist with the Testify Project. During her talk, Ilica Mahajan, who is involved with the Marshall Project as she completes a dual M.S. program at Columbia in journalism and computer science, described how the Test Project is seeking to establish patterns of injustice at the court system in Cuyahoga County in the Cleveland area. Historically, when journalists have written stories about the court system, “it has been sort of anecdotal with maybe some small datasets — but we really wanted to get a bigger picture of things and larger trends that were happening in a particular court system,” Mahajan said.
The data the Testify Project journalists access is public, but the publicly available website where the data is located is very complex and not very user-friendly for access and analysis. Additionally, the journalists need access to data for numerous defendants, each of which might be involved in different court cases and have different charges levied against them in criminal courts. Data about judges in the region is also scraped and analyzed.
Reporters fill out information for Airtable, which is a low-code tool for application development, so that the data is collected for access with a GraphQL API. “Hasura helps us to see and visualize all this wrangle data in one place,” Mahajan said.
Work in Progress
While the new Hasura and GraphQL features and interesting use cases the conference covered are with merit, we are still only at the cusp of what GraphQL and APIs, in general, can offer for data analysis and visualization in the future.
“There is a tremendous, tremendous amount of work to do in order to realize that future of being able to say, ‘can we only focus on centralized data, can we only focus on the edge with a data API that is automated forever and ever,’” Gopal said. “Moving towards that future is a lot of work. We’ve made some strides today, but there’s a tremendous amount of stuff to do.”