Introducing the Hasura GraphQL Engine
Get Instant Realtime GraphQL APIs on any Postgres based application, new or existing!
Last updated: August 6th, 2018
We are super thrilled to announce the launch of the Hasura GraphQL Engine, an open source product that gives you instant realtime GraphQL APIs on Postgres. You can try it out here — go ahead, check it out, it will take exactly 30 seconds to deploy it to Heroku’s free tier (yes — we counted ?).
The complete open source repo is available here.
The Rapid Adoption of GraphQL in the Enterprise
Since Facebook announced GraphQL three years ago, GraphQL’s adoption has grown exponentially, perhaps best illustrated by this npm trends chart.
Fortune 500 enterprises such as Intuit, Walmart, the New York Times and NBC and global startups, such as Airbnb, Docker, Github, Twitter, Pinterest, Uber and Yelp are among those who have adopted GraphQL to shrink product development cycles.
The Hasura GraphQL Engine
Our foray into GraphQL started earlier this year. We added GraphQL support to the Hasura Kubernetes platform’s data APIs. Over the last few months, we have been working toward releasing the GraphQL engine as a standalone product that can instantly add GraphQL APIs to existing Postgres databases.
The Hasura GraphQL Engine is an extremely lightweight, high performance product that gives you instant realtime GraphQL APIs on a Postgres database. This can be used to quickly build new applications on Postgres or fast-track the move to GraphQL for existing applications on Postgres.
It comes with a UI (an API explorer, a phpMyAdmin of sorts for Postgres) that lets you create and view tables on your database and make GraphQL queries using the embedded GraphiQL interface.
August 06, 2018 update: The Hasura GraphQL engine now supports subscriptions for all kind of queries. Any query can be converted into a subscription by replacing query with subscription as the operation type. Read more here.
Getting Started
Our aim with the Hasura GraphQL engine is to help you setup a GraphQL server with the least amount of friction, so that you can start building applications without any setup. With that in mind, we present the Hasura deployment on Heroku’s free tier.
30 seconds to GraphQL zen!
You can also use the docker container to run it anywhere.
Adding GraphQL to your existing applications
We designed the Hasura GraphQL Engine to allow developers running existing Postgres based applications to migrate to GraphQL without having to write any backend code.
Developers can simply choose tables from their new or existing database that they want to use with GraphQL and link those tables into a “graph.” This gives companies already using Postgres an easy, incremental way to start migrating to GraphQL.
In this video, we show you how you can query your existing gitlab instance with GraphQL.
Querying Postgres directly from your front-end apps
This is every backend developer’s nightmare!
The Hasura Engine comes with a granular, dynamic access control system that integrates with existing authentication systems such as Auth0 or custom implementations. This further aids in the incremental journey toward adding GraphQL to your existing applications. The Hasura Engine enables developers to define who can access what data (admin, anonymous users, etc.).
Architected for high-performance
While designing Hasura, we had two objectives:
- Hasura should be able to run anywhere, from your local machine to the Heroku free tier to a server on Amazon, Google or Microsoft.
- You should be able to extract maximum performance/dollar.
Consequently, we optimised Hasura for low memory footprint & latency. On the Heroku free tier, it consumes ~50MB of RAM even while serving more than ~1000 requests/per second.
If you’re interested in the architecture decisions involved in building this, you can read about it here.
How we stand apart from existing solutions.
Hasura was designed specifically to allow companies with existing Postgres applications to incrementally migrate to GraphQL, without affecting the application, database or users in any way.
- It works seamlessly with existing Postgres databases, i.e, adding Hasura to your current project which uses Postgres should not limit or change the way in which you use Postgres.
- The GraphQL Engine can also be exposed directly to clients without writing an intermediate graphql server. You can define the access control rules using a system inspired from Postgres’s RLS (Row Level Security) and integrate it with your existing auth backends with a simple webhook.
These two design choices distinguish Hasura’s graphql-engine from similar offerings, such as Prisma and Postgraphile.
Prisma aims to be an ORM like interface between your graphql server and the datastore. It abstracts away the underlying datastore with its own tooling.
Postgraphile can also be exposed to clients directly, however the access control of these APIs is through Postgres’s RLS which may or may not play well with your existing auth system.
Behind the scenes
Over the last few months, several folks from the GraphQL community have taken out time to review the GraphQL Engine and provided us their feedback! Several calls and coffees later, we can confidently say that for anyone looking to get started with GraphQL, the developer ecosystem around GraphQL is thriving and the community is super helpful! You’re in good hands! ?
We would especially like to thank some of our Kubernetes platform users (Josh, Sonicrida, Dylan, we ?you) who took the plunge and started building their projects and stealth startups on the Hasura GraphQL Engine.
We’d love to hear your stories! Do try Hasura out and let us know your thoughts. We are very active on our Discord server. You can also ping us on our website chat.
You can also check out our launch on hackernews here: https://news.ycombinator.com/item?id=17540263