GraphQL is a popular choice for enterprises looking to improve the performance, efficiency, and flexibility of their APIs. As a result, GraphQL Data Access from various databases is increasingly becoming a necessity. Features, such as fetching very specific data (no over or under-fetching), having a strongly typed system, and schema introspection makes GraphQL a great choice. In this post, we cover Hasura’s way of enabling GraphQL data access from various data sources, for a seamless transition to launch GraphQL APIs without writing any code.

More...

This post was originally published in Hasura.

Use Case: GraphQL Data Access

Problem Statement

Problem Statement


GraphQL offers a great way to query data from APIs. But building a GraphQL API interface for a data source is a tedious process. It requires considerable time, effort, and investment. Engineering organizations need to write a significant amount of code by hand just for the basic CRUD functionalities of the GraphQL API.

Realization Approach

Realization Approach


A platform like Hasura, that auto-generates GraphQL APIs to access data directly from the data producers, and offers built-in authentication and authorization layer for secured access, along with a unified, connected, and real-time, GraphQL API, that checks all the boxes for production grade deployment.

Solution Space

Solution Space


An instantly available GraphQL data access interface connected to various data sources such as Postgres Db, SQL Server and others, that saves months of development effort and reduces time-to-market by supporting critical GraphQL API infrastructure for production-grade performance.

More and more enterprises are asking themselves whether their technology stack is GraphQL enabled or not. However, spending time and resources on tedious development tasks related to GraphQL becomes detrimental to their core business.

This is where Hasura comes in.

Hasura is an open-source product that auto-generates GraphQL or REST APIs with a built-in authorization layer for your data. Point Hasura to the databases, REST & GraphQL endpoints, and third-party APIs, and it provides a unified, connected, real-time, and secured GraphQL API for all of your data.

Let’s take a look at the three ways in which Hasura can help your organization to get a jumpstart with GraphQL.


GraphQL Data Access

Data in the modern world most likely comes from multiple sources. In an enterprise environment, you might have data from sources such as your database(s), internal APIs, and third-party services.

That means there are time-consuming and repetitive tasks, such as connecting those data sources to your applications. After you connect them, the work continues by ensuring they function properly on their own and with the other existing data sources.

So each time a new data source needs to be integrated with an existing application, the process repeats:

Integrate the data source -> configure it -> test it -> maintain it

That can quickly become a bottleneck that slows down the development team and the application. So the question is – is there a better alternative? The alternative is Hasura.

Instant GraphQL Data Access

Hasura abstracts all the tedious, boring, and time-consuming work. You connect all the data sources (databases, REST and GraphQL APIs) to Hasura, and it automatically generates a unified, secure, and real-time GraphQL API.

In the case of databases, the Hasura GraphQL Engine automatically generates the GraphQL Schema and operations such as queries, subscriptions, and mutations. It also enables you to connect existing REST and GraphQL APIs to your Hasura application.

Hasura GraphQL Interface

Hasura unifies all data sources and enables the client to access unified data through the GraphQL API provided by Hasura. Creating a unified data-access API layer also allows developers to access and manipulate data in their database without having to write complex SQL queries. To access the data, developers can use the GraphQL API endpoint provided by Hasura to send queries and mutations that specify the data that should be retrieved or updated.

Additionally, Hasura provides several tools and features to help developers work with data more effectively. For example, the Hasura Console provides an intuitive interface for exploring and testing the GraphQL API, and the Hasura CLI allows developers to manage their data from the command line.

Overall, Hasura’s approach to data access makes it easy for developers to work with their data and build robust and scalable applications on top of enterprise data.

Hasura has native integrations with PostgresDB and other kinds of relational databases, making it an ideal foil for building the GraphQL layer for data ingestion into big data management systems. Additionally, it supports data warehousing platforms such as BigQuery and Snowflake.

API Production Readiness

In addition to improving data access, another primary business value Hasura provides is reducing the time to market by offering you critical features out of the box such as:

  • caching
  • real-time capabilities
  • authorization
  • observability

As mentioned previously, building a GraphQL API manually requires effort just for the basic functionalities. Implementing complex operational features like caching, real-time capabilities, or authorization requires even more effort.

Hasura GraphQL Interface

Traditionally, building an API manually takes weeks or months and a team of developers. In this process, the developers also need to optimize the API to be production ready. That includes security, authorization, availability, scalability, and observability.

Hasura GraphQL Interface

Hasura transforms the process of building the API into a service that comes with features such as authorization, real-time capabilities, observability, and availability out of the box. And everything highlighted in the above diagram.

Hasura and the developer tooling around it are designed to help teams build products faster and more efficiently.


Increased Developer Productivity

Hasura cuts down development time by 50% to 80%. You can find more from our case studies here. Hasura does this by automating key GraphQL development tasks such as defining schemas, writing resolvers, and setting up a server. Secondly, it automates and abstracts tedious tasks such as:

  • defining the GraphQL schema
  • defining and implementing the GraphQL resolvers
  • creating and configuring the GraphQL server

Such features are critical for an enterprise and tricky to implement. They require experienced API developers and a considerable amount of effort and time. Once they are implemented, someone needs to maintain them. Letting Hasura take care of them improves the developers’ productivity as they can focus on other critical tasks, like delivering core IP back to the business.

Hasura GraphQL Interface

Another thing that increases developer productivity is Hasura’s metadata. The metadata is the brain of a Hasura application that captures vital information such as the following:

  • connections to the data sources
  • mapping the model from the data sources into an API
  • relationships between the models
  • authorization rules

Hasura uses this metadata information to generate a JSON API schema and exposes it through a GraphQL API. GraphQL is ideal for working with JSON data, as it is native to the JSON format. As an API specification, GraphQL allows developers to create flexible and powerful APIs that can operate on a wide range of data models and support a variety of methods. At the same time, it maintains the controlled boundaries that are necessary for a web service.

Developers can then use the metadata to configure and manage their applications. As a result, it improves the developer experience and productivity since developers don’t have to write code to configure or enhance their applications.


Summary

Most of the work involved in building a Data API via GraphQL is either tedious and repetitive or difficult and time-consuming. It’ll require lots of effort and resources.

But it doesn’t have to be that way. Hasura enables enterprises to build a production-ready Data API, with all the critical features, without having to write any code. That makes it easy for developers to quickly and easily build scalable and reliable applications without spending time on tedious and complex tasks.

Overall, Hasura offers a comprehensive and robust platform for enterprise application development.

About the author 

Radiostud.io Staff

Showcasing and curating a knowledge base of tech use cases from across the web.

TechForCXO Weekly Newsletter
TechForCXO Weekly Newsletter

TechForCXO - Our Newsletter Delivering Technology Use Case Insights Every Two Weeks

>