Setting up a production ready realtime GraphQL backend in just a few minutes
Tags: graphql, hasura, baas, realtime
Published: 2018-11-20 15:43:28

---
title: Setting up a production ready realtime GraphQL backend in just a few minutes
published: true
description: DIY Realtime GraphQL BaaS
tags: graphql, hasura, baas, realtime
canonical_url: https://blog.hasura.io/setting-up-a-production-ready-realtime-graphql-backend-in-just-a-few-minutes-720988a70cbb
---

Since Facebook [announced GraphQL](https://code.fb.com/core-data/graphql-a-data-query-language/) three years ago, GraphQL popularity has grown by leaps and bounds. In the [2018 state of javascript survey](https://2018.stateofjs.com/data-layer/overview/), 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](https://thepracticaldev.s3.amazonaws.com/i/343gpa387kdplx7nwtdk.png)
<figcaption>npm trends for GraphQL</figcaption>

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](https://hasura.io/diy-graphql-baas). It uses the [Hasura GraphQL Engine](https://github.com/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](https://cloud.digitalocean.com/droplets/new?image=hasura-18-04). It comes with a Postgres database and Caddy webserver for easy and automatic HTTPS using Let’s Encrypt.

![Deploy Hasura GraphQL on DigitalOcean](https://hasura.io/rstatic/dist/aff7bcdcffab8cf6be860b30f687ab2e.png) 
<figcaption>Deploy Hasura GraphQL on DigitalOcean</figcaption>

2) [Create your schema](https://docs.hasura.io/1.0/graphql/manual/getting-started/first-graphql-query.html) using the Hasura console. The Hasura GraphQL Engine will give you instant GraphQL APIs, for queries, mutations and subscriptions.

![Create schema Hasura](https://hasura.io/rstatic/dist/a3334540075c7ca1266194670ddb56a3.png)
<figcaption>Create schema</figcaption> 

3) Configure Auth0 rules and callback URLs, and [integrate](https://docs.hasura.io/1.0/graphql/manual/guides/integrations/auth0-jwt.html) it with Hasura.

![Auth0 setup](https://hasura.io/rstatic/dist/d01922a476e7cbee087e6884bb406ff2.png)
<figcaption>Configure access control rules</figcaption>  

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](https://docs.hasura.io/1.0/graphql/manual/deployment/index.html) or [authentication provider](https://docs.hasura.io/1.0/graphql/manual/auth/index.html). 

## 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: 

* Write custom backend code or business logic and use [schema stitching](https://blog.hasura.io/the-ultimate-guide-to-schema-stitching-in-graphql-f30178ac0072) to merge with Hasura.
* Manage postgres [migrations](https://docs.hasura.io/1.0/graphql/manual/migrations/existing-project.html). 
* [Trigger webhooks](http://hasura.io/event-triggers) on Database events to integrate with serverless functions.
* Set up logging and monitoring with [DataDog](https://blog.hasura.io/uptime-monitoring-for-hasura-graphql-engine-with-datadog-on-gke-4faff5832e7f) and [Honeycomb](https://blog.hasura.io/graphql-observability-with-hasura-graphql-engine-and-honeycomb-ee0a1a836c41)

If you get stuck somewhere or you have some questions, feel free to talk to us on our [Discord](https://discord.gg/3FNQnWj).

Full disclosure: I am an engineer working at [Hasura](http://hasura.io).