Setting up a production ready realtime GraphQL backend in just a few minutes
Announcing the DIY Realtime GraphQL BaaS using Hasura, DigitalOcean and Auth0
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.
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:
- 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.
2) Create your schema using the Hasura console. The Hasura GraphQL Engine will give you instant GraphQL APIs, for queries, mutations and subscriptions.
3) Configure Auth0 rules and callback URLs, and integrate it with Hasura.
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:
- Write custom backend code or business logic and use schema stitching to merge with Hasura.
- Manage postgres migrations.
- Trigger webhooks on Database events to integrate with serverless functions.
- Set up logging and monitoring with DataDog and Honeycomb
If you get stuck somewhere or you have some questions, feel free to talk to us on our Discord.