Hasura Backend Setup
The first step in the tutorial is to setup the backend with Hasura and create the necessary data models.
Setup GraphQL Backend with Hasura
Let's start by deploying Hasura.
One-click deployment on Hasura Cloud
The fastest way to try out Hasura is via Hasura Cloud. Hasura Cloud gives you a scalable, highly available, globally distributed, fully managed, secure GraphQL API as a service!
Click on the following button to create a new project on Hasura Cloud:
Note: It is free to signup and no credit-card is required.
Once you register and sign in, you should see the following welcome screen:
Hasura requires a Postgres database to start with. We can make use of Heroku's free Postgres database tier to set this up.
Try a free database with Heroku button. After logging in to Heroku, Hasura Cloud will perform the following for you:
- Create an app on Heroku
- Install Postgres Add-on
- Fetch database URL that you can use to configure Hasura
Once the database URL is fetched, you can click on
Create Project button to deploy an instance of Hasura. Once the project is created, it might take a few seconds to initialise.
Once the project is initialised, we can open the Hasura Console to get started.
Open the Hasura console
Click on the
Launch Consolebutton to open the console.
It should look something like this:
Great! You have now deployed Hasura and have the admin console ready to get started!
Apply database migrations
Let's get started by creating the tables and relationships for the Realtime todo app.
Download the hasura project with migrations from here
Configure the endpoint to point to the Hasura Cloud app URL. Open the
config.yaml file and set the endpoint value. Note that your Hasura Cloud app URL will be different.
Now let's apply the migrations.
hasura migrate apply
This will create the tables and relationships for the realtime todo app.
Great! Now navigate to the Hasura Cloud app to see the schema on the Hasura console.