/

hasura-header-illustration

Announcing Event Triggers on Hasura GraphQL Engine

After much work and sweat over the last few months, I’m extremely happy to announce the public preview of a feature that allows you to trigger webhooks on database events!

Check it out at https://hasura.io/event-triggers/ and try it out on Heroku or with Docker.

This feature is a part of the open-source Hasura GraphQL engine :)

Event-triggers on Postgres with Hasura

With Hasura, creating an event-trigger to listen to a database change on Postgres takes all of 60 seconds:

Create an event trigger for a webhook on a table

Coupled with serverless deployments, this allows our developers to build some really cool things very easily:

  1. Push notifications that get triggered when a new review is added
  2. Purge your CDN or cache to re-render your static content
  3. Update a search index when a product is inserted, updated or deleted
  4. Trigger business logic that can run asynchronously

Check out more use-cases, demos and tutorials on the website: https://hasura.io/event-triggers/

How it works

Triggering webhooks on events are a deceptively simple feature. However, creating events and triggering actions is something fraught with edge-cases that we’ve spent a lot of time working through. Here are some of the things you _don’t_ have to worry with Hasura event-triggers!

  1. Atomic generation of events: If something happened in the database, then the event is captured ?%. Any source of database changes is fair game. A GraphQL mutation, a legacy REST API, a cron-job, direct SQL changes. In fact, events are even captured if Hasura is not running, going through a restart or deployment rollout.
  2. Reliable delivery of events: You can configure retry logic and a retry interval.
  3. Horizontally scalable: You want to deliver more events faster? Just scale Hasura horizontally and stay calm.
  4. Debugging and Observability: Building async logic, especially with serverless functions, is so much fun when you’re trying things out and simultaneously so much nightmare in production. A large part of this is because debugging and tracing events in the new sphagetti backend requires extra instrumentation. With Hasura, events & invocations are already instrumented and the highly structured and informative logs make it easy for you to trace everything from errors to latency issues with your favourite tools :)

Realtime GraphQL ❤️ Serverless triggered by database events

I’m personally the most excited about the killer combination of realtime GraphQL (live-queries) and async business logic.

I’ve put together a video describing what an app using serverless for complex business logic in a real world situation would look like and it’s super fun to look at!

Try it out!

This is a public preview release and we’re eagerly waiting to hear what you think. Take it for a spin at https://hasura.io/event-triggers/ and try it out on Heroku or with Docker.


Blog
05 Sep, 2018
Email
Subscribe to stay up-to-date on all things Hasura. One newsletter, once a month.
Loading...
v3-pattern
Accelerate development and data access with radically reduced complexity.