Hasura Brings REST APIs to GraphQL
One common narrative around application programming interfaces (APIs) these days is one of transition from REST API to GraphQL, but the reality more often than not is an in-between ground that will continue for years to come. For that reality, companies like Hasura, which offers managed cloud and enterprise versions of the Hasura GraphQL Engine open source project, now give organizations a way to enjoy the best of both worlds.
Hasura’s primary goal is to address what it says are the “bottlenecks to data access for frontend and full-stack developers” by making GraphQL APIs more accessible, realizing the dream of GraphQL, explained Hasura Chief Operating Officer and co-founder Rajoshi Ghosh.
Excited About GraphQL
“People are really excited about GraphQL, specifically, front end and full-stack developers, because there’s a beautiful ecosystem. It’s basically the dream; they don’t need to wait for somebody to build a specific API for them, they just can request for what they want,” said Ghosh. “That’s the dream of GraphQL, which is why developers love it, but the reality is, it’s just a specification. To get the beauty of GraphQL, you need somebody to stand up a GraphQL server or expose it to you.”
Tanmai Gopal, CEO and co-founder of Hasura, explained that tools like Apollo GraphQL provide a library with which to write a GraphQL server, but that “Hasura takes a slightly different approach and says that you don’t have to build the GraphQL server and write code for it,” a task that he says can take weeks if not months. Instead, developers can declaratively configure a web server and expose a production-ready API in minutes.
In addition to quickly spinning up a GraphQL API, Hasura also allows developers to integrate multiple data sources into that graph, including databases such as SQL, PostgreSQL, YugaByte, Timescale, and Google Big Query. Now, the company has moved to include REST APIs among that list of data sources.
REST API Connectors and Data Hub
Hasura first released a type of REST API support earlier this year with Hasura 2.0, giving its GraphQL customers the ability to offer access to a REST endpoint, if needed. Now, the company has launched bi-directional REST API Connectors alongside a Data Hub, with both features intended to give organizations even easier access to existing REST APIs using GraphQL.
“What we’ve done so far is that we made it super easy to bring in databases and other GraphQL services. What we’re doing now is that we’ve made it really easy to bring in existing rest APIs as well,” said Gopal. “The problem that Hasura is solving is making it easy to bring REST APIs into GraphQL by solving the transformation problem, and then by solving certain specific GraphQL problems, like authorization, caching, and API rate limiting.”
While the ability to import REST APIs into GraphQL already exists, part of the appeal here again lies in the fact that Hasura handles the heavy lifting aspect of this, instead of requiring a back-end developer to build the GraphQL connection to that REST API.
“With Hasura, what we’ve done is built a transformation engine that has a very nice developer experience in declaratively transforming the REST endpoint into a GraphQL that is going to fit in well with the rest of your GraphQL API,” said Gopal. “Instead of you spending time writing code, and then deploying and maintaining that code, that portion is now dramatically simplified.”
Integrating Third-Party REST APIs
In addition to importing their own REST APIs, Hasura users can also integrate third-party REST APIs with the new REST API connectors. On that point, Hasura has also created its Data Hub, which is a repository of pre-configured third-party REST APIs from services such as Contentful, Elastic, Fauna and IBM Open API. With the Hasura Data Hub, users can not only build external REST APIs into their own GraphQL endpoint, but the community at large can also contribute their own REST APIs into the Data Hub for use by others.
In addition to these features around REST and GraphQL, Hasura also launched beta support for Google Cloud on its managed Hasura Cloud offering. Users can now choose their own regions and connect to their existing data sources on Google Cloud, eliminating network egress costs between Google and Hasura Cloud.
Moving forward, Gopal said that Hasura will focus on delivering features to handle GraphQL for large amounts of data, as well as allowing the community to contribute their favorite data sources more easily to the open source Hasura project.