GraphQL and Serverless with Hasura

Developer Advocate

Web / Mobile / VR / AR / IoT

GDE, author, consultant

What is GraphQL

RESTfull API

The core idea is to have a URL for every resource

Description of resource is coupled to implementation

Overfetching

Underfetching

chaining requests to server to get needed data

GraphQL

A query language for your API

GraphQL

What is Hasura

open source and free engine that gives you auto-generates real-time GraphQL API on top of new or existing Postgres database

Features

  • Can be deployed to any cloud or run locally
  • Compatible with all Authentication solutions
  • Can run on top of new or existing Postgres database
  • Supports Postgres addons (PostGIS, TimescaleDB)
  • Auto-generates GraphQL api
  • GraphQL queries are compiled to performant SQL statements using native Postgres features

Features

  • Comes with hasura-cli which has awesome tools like migrations and more
  • Can work with custom SQL statements
  • Has configurable access controls for data
  • Can be connected to your own GraphQL server (does schema stitching)
  • Has eventing system which enables to trigger serverless functions

How to get started?

  • Go to hasura.io

  • Click on Get started with Heroku

  • Click on

  • Enter your app name

Let's see it in action

Hasura Console overview

Hasura Console overview

  • GraphiQL - run your queries in in-browser IDE
  • Data - manage your data, access control, relations, permissions
  • Remote Schemas - stitch GraphQL schema of your custom GraphQL server
  • Event Triggers - connect your serverless functions

GraphiQL tab - use for development

  • Set endpoint headers
  • Execute queries and mutations
  • Analyse queries

Data tab - data management interface

  • View and insert data into db
  • create and modify tables
  • Create relationships
  • set permissions and access control
  • execute custom sql statements

Remote Schemas tab

stitch your custom GraphQL server schema

Event triggers

  • connect custom webhooks to database events to execute serverless functions
  • set retry logic
  • forward custom headers to webhook

 

Authentication

Run hasura locally on top of existing postgres

{ Show me some code }!

Thank You

Backend tutorial: https://learn.hasura.io/graphql/hasura

React tutorial: https://hasura.io/react-graphql

 

  @VladimirNovick

GraphQL deep dive with Vladimir Novick & ReactJS Academy

By vladimirnovick

GraphQL deep dive with Vladimir Novick & ReactJS Academy

In this talk we will see what are the benefits of building event driven serverless Realtime GraphQL backend and what problems it will solve. We will see how we can bootstrap our serverless backend fast with Hasura engine and provide our web or mobile apps with modern GraphQL api.

  • 1,288