DEV Community

Praveen Durairaju for Hasura

Posted on • Updated on • Originally published at blog.hasura.io

Setting up a production ready realtime GraphQL backend in just a few minutes

Since Facebook announced GraphQL three years ago, GraphQL popularity has grown by leaps and bounds. In the 2018 state of javascript survey, 83% of JS developers had either used GraphQL or wanted to learn it, and it is well on its way to becoming a megatrend.

npm trends for GraphQL

npm trends for GraphQL

Adopting GraphQL can result in a significant increase in feature velocity, and any organization looking at new product development or re-architecting their existing products should seriously evaluate GraphQL and the benefits that it brings.

Getting started with GraphQL quickly

At Hasura, we have just released the DIY Realtime GraphQL BaaS. It uses the Hasura GraphQL Engine, Auth0 and DigitalOcean, to help you setup a production ready GraphQL backend in a few minutes - sort of like Firebase, but for realtime GraphQL, over Postgres, on your own infrastructure. It offers you the ease of use of a BaaS (set up in a few minutes), while allowing you to retain flexibility and control going forward.

Here’s how you can set it up:

1) Deploy the Hasura GraphQL engine on DigitalOcean using the one-click deploy. It comes with a Postgres database and Caddy webserver for easy and automatic HTTPS using Let’s Encrypt.

Deploy Hasura GraphQL on DigitalOcean

Deploy Hasura GraphQL on DigitalOcean

2) Create your schema using the Hasura console. The Hasura GraphQL Engine will give you instant GraphQL APIs, for queries, mutations and subscriptions.

Create schema Hasura

Create schema

3) Configure Auth0 rules and callback URLs, and integrate it with Hasura.

Auth0 setup

Configure access control rules

And that’s it! You have a full-fledged backend with GraphQL APIs and Authentication/authorization on managed infrastructure. On the 5$ machine, you should be able to handle thousands of users. Of course, if you want to handle more users, you can just upgrade the underlying infra.

We have used DigitalOcean and Auth0 for this example for their ease of use, you can use any other infrastructure provider or authentication provider.

Next steps

Once you have the BaaS setup, there are tons of other cool things you can do as you build complex applications, and take them to production:

If you get stuck somewhere or you have some questions, feel free to talk to us on our Discord.

Full disclosure: I am an engineer working at Hasura.

Top comments (0)