Hasura FAQ: What are the best practices? (Part 1)

Have you been wondering about best practices with Hasura? Here’s a quick rundown of some of our recent FAQ’s.

What's the best practice for managing business logic?

Actions are the new hotness for business logic. Check out:

Other approaches for custom business logic:

Our blog post on all of the above

Is there a way to prevent GraphQL queries from becoming a pile of strings?

Sounds like you’re looking for a fluent GraphQL client. We wrote about this recently: Fluent GraphQL clients: how to write queries like a boss

These clients give you the ability to write queries as objects instead of strings. Some of them also integrate with TypeScript and eliminate duplicate data definitions.

Hasura migrations make managing environments easy. Check out:

I want to have my own custom signup flow. What’s the best way to achieve this?

Actions allow you to run business logic before executing a mutation. With an action, you can call an HTTP webhook (a REST endpoint or a serverless function) that talks to your auth provider, sign up the user with the provider, and save the user to your database afterwards. And here’s the kicker: Hasura provides a codegen that generates the handler code for you.

Also, check out this guide on creating a GraphQL API for Notion with Hasura Actions.

I don't see Actions on my console. How do I go about enabling it?

Update your Hasura GraphQL engine to the latest stable version.

That’s it for now. Do you have any burning questions regarding best practices with Hasura? Ask us in the comments! 👇👇👇

07 Mar, 2020
Subscribe to stay up-to-date on all things Hasura. One newsletter, once a month.
Accelerate development and data access with radically reduced complexity.