DEV Community

Hasura for Hasura

Posted on • Originally published at blog.hasura.io on

Getting started with the Hasura GraphQL Engine

Instant Realtime GraphQL APIs on any Postgres database

TL;DR

  1. Introducing the Hasura GraphQL Engine
  2. Basic deployment on Heroku, and connecting to an existing Heroku Postgres database.
  3. Basic deployment using Docker, and integrating with an existing Postgres database.
  4. Using the built-in access control, and a sample integration with Auth0.
  5. Community resources

Introducing the Hasura GraphQL Engine

The Hasura GraphQL Engine is a high performance GraphQL server that gives you instant realtime GraphQL APIs over Postgres.

Hasura helps you build GraphQL apps backed by Postgres or incrementally move to GraphQL for existing applications using Postgres.

Some of Hasura’s features include:

  • Works with existing, live databases : Point it to an existing Postgres database to instantly get a ready-to-use GraphQL API
  • Realtime support: Convert any GraphQL query to a live query by using subscriptions.
  • Dynamic access control that can integrate with your auth system (eg: auth0, firebase-auth).
  • Built-in support for powerful queries : filtering, pagination, pattern search, bulk insert, update, delete mutations.
  • An Admin Console UI & Rails-inspired schema migrations
  • Postgres ❤️ : supports Postgres types (PostGIS/geo-location, etc.), turns views to graphs, trigger stored functions or procedures with mutations.

The Hasura Admin Console lets you create and view tables in your Postgres database and query them using the embedded GraphiQL interface.

You can deploy Hasura on either Heroku, or using a Docker container.

Getting Started with Heroku

Here’s how you can make a basic deployment of Hasura on the Heroku free tier:

If you are already running on Heroku Postgres, Hasura can also connect directly to give you GraphQL APIs. You can get step-by-step instructions here.

Getting started with Docker

To get the Hasura GraphQL engine and a fresh Postgres instance running as Docker containers, simply follow the three steps here. This is the easiest way to setup Hasura in your local environment.

In case you’d like to run Hasura on an existing Postgres database, follow this guide to deploy the Hasura GraphQL engine as a standalone docker container and connect it to your Postgres instance.

In this video, we add Hasura to an existing Gitlab instance, and query it using GraphQL:

Using the built-in access control system

Hasura comes with a granular, dynamic access control system that can also integrate with existing authentication systems such as Auth0 or custom implementations.

For example, suppose you wish to integrate with Auth0:

Similarly, you can integrate Hasura with other auth providers as well. This page has a constantly updated list of sample integrations.

Community resources

Hasura is an open source project, and you can find the repo here. In case there is a feature you would like to see, or a bug you would like to fix, please create an issue here (or, submit a pull request 😀).

For more immediate support, you can also join the Hasura discord.

Top comments (0)