Skip to main content

Hasura

Hasura is an open-source tool that can generate GraphQL APIs for your databases in real time. With Hasura, you can manage your data and run queries on it using GraphQL. GraphQL is a modern query language that, with just one endpoint, can get the data you want from several sources. This way, only the data you request is returned, nothing more.

Hasura makes it easy to build scalable, flexible applications by creating a GraphQL API layer between different data sources and the application. Other useful Hasura features include real-time updates, complex queries, and integration with authentication tools.

One-Click Deployment​

With Arvancloud Cloud Container ready-made applications, you can set up Hasura with just one click.

Deploy with one click

When creating the Hasura ready-made application, a PostgreSQL database is created automatically to store Hasura's metadata and your application's data. However, you can use another database for your application's data.

Note that if you connect the app to another database, a database is still needed to store Hasura's metadata, and a PostgreSQL is created for this during its deployment.

Using Hasura​

After the application is deployed on the Arvancloud Cloud Container, you can access Hasura through the free Arvancloud domain or your own domain (if you set it on this application).

Creating Tables​

With Hasura, you can define tables and their relationships in this app's console or with a GraphQL schema.

For example, we create two tables for the article and author schemas:

author (
id SERIAL PRIMARY KEY,
name TEXT
)

articles (
id SERIAL PRIMARY KEY,
title TEXT,
content TEXT,
rating INT,
author_id INT
)

To do this, go to the Data menu in the Hasura panel and click Create Table. After entering the columns' information, click Add Table to save it.

Adding Data​

After creating a table, you can add your data to it. To do this, go to the table you want in the Data section and add your data in the Insert Row tab.

Running Queries​

Now that you've created a table and entered sample data in it, you can run simple GraphQL queries from the API section of the Hasura panel.

For example, the following query shows all rows of the "articles" table:

query {
articles {
id
title
author_id
}
}

To learn more about this application, you can use the Hasura documentation.