Hasura Brings Declarative Programming to GraphQL API Development

During Day 1 of GraphQL Summit, Tanmai Gopal, CEO, and co-founder of Hasura introduced his company’s declarative approach to creating GraphQL APIs during an exclusive interview with ProgammableWeb. Hasura is an open-source solution that provides complete support for the GraphQL specification but does so in a way that stresses declarative configuration over text-based type definition.

During his introduction, Gopal pointed out that whereas other implementations of the GraphQL specification require significant amounts of programming time to achieve production-ready software, Hasura declarative configuration approach allows developers to create a GraphQL API quickly by referencing an existing Postgres database. Hasura does not use typical GraphQL resolvers to execute query and mutation behavior. Rather the Hasura engine has a compiler that converts queries and mutations into efficient SQL statements which are automatically executed as part of the generated GraphQL API.

According to Gopal, a developer can use the Hasura Web interface to create Postgres tables and the implicit GraphQL types, queries, and mutations that make up the GraphQL API. Or, as Gopal also points out, “you can point Hasura at a complex table and have a GraphQL API in 30 seconds.”

In addition to binding queries and mutations to SQL statements, the Hasura engine has an event triggers feature that allows custom microservices and serverless functions to provide additional processing behavior. Developers routing event data to microservices and serverless functions as declarations implemented within the Hasura web page interface.

Hasura provides full support for GraphQL subscriptions. Hasura generates subscriptions for entities on the backing Postgres automatically. Subscriptions are defined as part of the overall API definition process facilitated visually using Hasura’s web UI. Also, developers can bypass the web UI and configure Hasura directly in YAML.

Gopal pointed out that, “a declarative approach is more efficient because you get a lot more power with a lot less code.” 

Be sure to read the next GraphQL article: Apollo GraphQL CEO Predicts the Rise of Omni Channel API Development