Hasura launched an open-source GraphQL engine that connects to various databases, serverless functions, and microservices and auto-generates a production-ready GraphQL backend.
The Hasura GraphQL-based engine lets you configure event triggers for the Postgres database within minutes and helps to build instant and real-time GraphQL applications backed by PostgreSQL. While designing the GraphQL engine, team Hasura subjected to fulfill two main objectives in the nutshell, i.e.
It can accept client-app requests and easily evolve with your needs by processing 1000 queries/second (approx.), consuming only 50MB of RAM storage. The Hasura GraphQL engine contains a cutting-edge Postgres ecosystem with your favorite extensions and scales up to 1 million active GraphQL subscriptions and live-queries.
This blog is about giving a quick overview of the Hasura engine, its architecture, features, and use-cases. To get a better understanding, you must read it till the end-
Hasura comes with a wide string of features, as given under-
Hasura helps you setup the GraphQL server with the lease of hassle and you can start building applications within a fraction of time.
In order to use the Hasura GraphQL engine, first, we need to run the engine having access to the PostgreSQL database and then use the console, that connects to the GraphQL engine, to build schema and run queries and mutations.
The Hasura GraphQL engine automatically generates a GraphQL schema in the Postgres database and process queries, mutations, and subscriptions.
Let’s see what actually the Hasura GraphQL engine does-
When one tracks a Postgres table/view in Hasura, the GraphQL engine generates GraphQL schema components and create a connection among them.
Tables: While tracking Postgres tables, it routinely generates the following schema components, -
Views: While tracking Postgres views, the Hasura GraphQL engine generates the same components as does for the table, except for mutation fields.
Relationships: While creating a relationship between table/view with another table/view, the Hasura GraphQL engine-
All the information about schema generation is been stored as ‘Metadata’ by the Hasura GraphQL engine in its catalog.
Whenever one performs certain actions on the console, the Hasura GraphQL engine records it in the hasura_metadata_schema which is a hdb_catalog schema in the Postgres database. For instance, when a table is being tracked, an entry as hdb_catalog.hdb_table table is created in the Postgres database and quite similarly there are more tables to track functions, event triggers, relationships, and remote schemas.
This metadata can be exported in JSON format as hasura_metadata.jsonfile as a representation of the state of Hasura.
Hasura provides a way of accelerating GraphQL API adoption and application developing productivity on your microservices & serverless functions. It can connect and configure relationships across databases, external SaaS APIs, “mid-tier” microservices, and event-driven business logic without any upstream changes and picturize a unified GraphQL API.
It takes in metadata configuration at runtime so that the developers can map API resources and upstream data-models to an interconnected graph.
Actions are user-defined mutations that seamlessly integrate and migrate an event-driven business logic into your GraphQL APIs. Team Hasura thought about using these ‘Actions’ in event-driven patterns in which the ‘read-models’ and ‘write-models’ are kept separate from each other. This architecture is able to deal with increasing complexity.
Hasura also helps in creating custom GraphQL mutation specifications which are converted to events and further delivered to microservices & serverless functions. The Hasura GraphQL engine interacts with microservices under event-driven logic workflow and allows easier decoupling and fault-tolerance without compromising on scalability.
Hasura Actions have several benefits over backend workflow, such as-
The Hasura GraphQL Engine merges schemas from multiple remote GraphQL servers and stitches them together at a single endpoint in the form of a unified GraphQL API. All you have to do is to create a GraphQL service and then provide its endpoint to Hasura. The GraphQL services provide support to all languages/frameworks.
The directory comprises GraphQL backend boilerplates (regular as well as serverless) for custom GraphQL servers using various languages, deployment runtimes, and serverless platforms-
The remote schemas have several use cases, that include various supporting features for payments, customizing mutations, and fetching dissimilar data from distinct sources.
Due to faster query processing, easier setup of permissions and relationships, blazing-fast production, and great UX, it is gaining huge popularity among fortune 500 companies.
https://hasura.io/
https://hasura.io/docs/
https://github.com/hasura/graphql-engine/