← Back to Guides
Profile image for Amit Wani

By Amit Wani

Published 31st May 2022

Hasura offers instant GraphQL APIs for your data within minutes for free! We can run Hasura, locally or in the cloud, and connect it to your new or existing databases to instantly get a production-grade GraphQL API.

Hasura is compatible with all GraphQL tooling and works with PostgreSQL and MySQL Server.

Hasura’s built-in RLS style authorisation engine allows you to specify authorisation rules at a model level conveniently, and safely expose the GraphQL API to developers inside or outside your organization. 🔐

We can either use Hasura Core which is open-source, includes all core features and can be deployed anywhere with Docker or use Hasura Cloud which is fully managed.

This guide will show you how to deploy Hasura Core using their public Docker image on Northflank with a PostgreSQL database.

PostgreSQL Addon

  1. Create a new PostgreSQL addon on Northflank.

  2. Under Networking, ensure to tick ‘Deploy with TLS’ and ‘Publicly accessible’.

    • These two options will ensure your addon is exposed publicly to the internet and accessible to Hasura.

    Deploy Hasura on Northflank, create PostgreSQL addon

Secret Group

  1. Create a new secret group of type ‘Runtime’ to share Environment variables across different services and addons.

  2. Add the following key-value pair secrets:

  3. Under Linked addons select Configure for the PostgreSQL addon we just created.

  4. Select POSTGRES_URI and add an alias POSTGRES_URI.

    Secret group creation for Hasura deployment on Nortfhlank

Hasura GraphQL Engine

  1. Create a new deployment service in Northflank for Hasura Core GraphQL Engine using their public Docker image as below.

    Service creation

  2. Set the image path as hasura/graphql-engine:v2.6.1 (version can change depending upon Hasura's releases) You can refer to this docker-compose.yml for the latest version to use.

    Hasura GraphQL Docker Image

  3. Add an 8080 port in the networking and expose it using the internet if you want to access the Hasura Console or you can use Northflank’s CLI to port forward to your machine.

    Port 8080 addition to service

  4. We have successfully created the Hasura Core GraphQL Engine service.

Accessing Hasura Console

  1. Open the Hasura Console in your browser by going to the public domain for your Hasura GraphQL Engine service or port forward to your local machine. You should see something like this.

    Hasura Dashboard

  2. Switch to the Data tab to connect our PostgreSQL database. Fill in the details below for database connection. We can reuse the same environment variable here.

    Connect PostgreSQL database to Hasura

  3. After our database is connected, navigate to the PostgreSQL database from the left. We will try to apply a template from Template Gallery to get started. Click on the “Hello World” template.

    Import a template from Template Gallery in Hasura

  4. Click on Install Template. It will create necessary Schema and Tables with some dummy data to play around with.

    Install template in Hasura

  5. You can see dummy data created in the tables article and author.

    Sample data from Hello World template

  6. We switch to the API tab and test GraphQL APIs.

    API tab in Hasura

    a. Fetching Articles (Query)

    query FetchArticles {
      helloworld_article {
       author {

    Query in Hasura

    b. Create a user (Mutation)

    mutation MyMutation {
        {author_id: 10, rating: 10, title: "New Article"}) {

    Mutation in Hasura

There is a lot of stuff you can now do with the Hasura platform. You can learn a lot from this tutorial by Hasura. Fullstack GraphQL Tutorial Series | Learn GraphQL & Hasura

Hope you enjoyed and learned from this guide on how to deploy Hasura on Northflank. Till the next time cheers!

Using Northflank to deploy Hasura

Northflank allows you to deploy your code and databases within minutes. Sign up for a Northflank account and create a free project to get started.

  • Connect with your preferred VCS: GitHub, GitLab or Bitbucket
  • Manage build arguments and environment variables using secret groups
  • Scale vertically and horizontally with multiple replicas per service
  • Deployment of Docker containers
  • Observe & monitor with real-time metrics & logs
  • Low latency and high performance
  • Multiple read and write replicas
  • Backup, restore and fork databases

Share this article with your network