Getting Started

Hasura GraphQL Engine gives you an instant GraphQL API on top of a PostgreSQL database, with role-based permissions and an admin console for managing schemas and testing queries. Available as an open web service in Eyevinn Open Source Cloud.

Prerequisites

Step 1: Create a PostgreSQL database

Navigate to the PostgreSQL service and click "Create psql-db". Enter a name and a password. The connection URL has the form postgres://postgres:<password>@<IP>:<PORT>/postgres. Hasura uses this database both for its own metadata and as the first data source.

Step 2: Store credentials as secrets

Open the GraphQL Engine service, go to the tab "Service Secrets" and create two secrets:

  • hasuradb with the PostgreSQL connection URL
  • hasuraadmin with a long random string. This is the admin secret that protects the console and the metadata API.

Step 3: Create the instance

Go to the tab "My graphql-engines" and click "Create graphql-engine". Enter these values:

Field Value
name myhasura
DatabaseUrl {{secrets.hasuradb}}
AdminSecret {{secrets.hasuraadmin}}
EnableConsole true (optional, turns on the web console)
JwtSecret JWT configuration (optional)
UnauthorizedRole Role for unauthenticated requests (optional)

Step 4: Open the console

There is no default username or password. Click the instance card, open the console and enter the admin secret from hasuraadmin when asked. Use the Data tab to track your tables and the API tab to try queries.

Usage example

Send requests to https://<your-instance-url>/v1/graphql with the admin secret in the x-hasura-admin-secret header:

curl -X POST https://<your-instance-url>/v1/graphql \
  -H "Content-Type: application/json" \
  -H "x-hasura-admin-secret: <admin secret>" \
  -d '{"query":"{ __typename }"}'

For applications, do not ship the admin secret to browsers. Set JwtSecret and UnauthorizedRole and define permissions per role instead.

CLI usage

osc create hasura-graphql-engine myhasura \
  -o DatabaseUrl="{{secrets.hasuradb}}" \
  -o AdminSecret="{{secrets.hasuraadmin}}" \
  -o EnableConsole="true"

Resources