Best submissions of Hasura Tips and Tricks 2021
Software development is now a trade, and as any tradesperson knows, the journey to mastery goes beyond the formal training to the discovery and sharing of knowledge. This collection of knowledge are the tips and tricks that ship products faster, reduce the number of bugs in production, and ultimately, make for a richer experience. Sharing this knowledge makes for a richer community of tradespeople.
Hasura’s first "tips and tricks" contest has concluded, and we loved seeing all the amazing submissions! Without particular order, here's the final collection of the top community Tips and Tricks from 2021.
How to connect Hasura GraphQL real-time Subscription to a reactive Svelte frontend using RxJS and the new graphql-ws Web Socket protocol+library
Real-time is the only time that matters in today's fast-paced digital ecosystem. While Hasura is here to send you the data as and when it becomes available, consuming this data on the front-end takes finesse. Raul Nohea writes up a compelling stack for solving exactly this problem with Svelte, RxJS, and the all-new graphql-ws library.
Hasura Permissions Viewer
User Kazam released a great utility for viewing permissions in Hasura to get a nice overview of what data is accessible and to whom. This is a fantastic utility for diffing migrations in a CI/CD workflow. If you want to catch the video version of this tool, you can see the full presentation at the December 2021 Community Call.
Hasura Change Summary - GitHub Action Demo
Speaking of CI/CD and community calls, Nick Amoscato (namoscato) shared their open-source Github action for diffing all Hasura metadata changes. It’s integrations like this that make being an open-source company so rewarding.
Hasura example on Railway
Speaking of open-source, while we are partial to Hasura Cloud and all the benefits it adds to the Hasura stack, we’re also big fans of the many amazing providers in the community that let you run Hasura on your own stack, whatever the reason may be. Add some open analytics into the stack and there’s nothing not to like in this stack from commandodev.
Load Balanced Hasura on EC2
Continuing along the vein of self-hosted Hasura, when you put a load-balancer in front of an ec2 instance, you can ping the /healthz endpoint for a server health check. If self-hosting Hasura on AWS is important to you, check out our support for VPC Hasura installs. Shout out to user sachsom for this submission.
Allow list script
We’ll never bash our users, but we love it when users bash (script) Hasura. If you’re looking for a fast-path to allow lists, this script has you covered. Automated API attack-surface restriction for the win. Thanks leica!
Sqrly
Besides objectively being the best-named project, Sqrly provides the tooling and opinionated methodology for working with custom SQL in a Hasura project. Custom SQL functions enable next-level power user functionality in Hasura, and this workflow is a must-see. Kudos jasonpjason, let us know when you set up the names-as-a-service company.
Multiple Instances of Hasura
If you can’t get enough of Hasura, which we completely understand, and want to run all the instances, then this guide is for you. Thanks for the submission Yasnil Dyap!
Computed Fields in custom checks
Julien Goux takes us deep into power-user mode with this one. Computed fields in custom checks is a very useful tip to add in your toolbelt for cases where the query is just too hairy or even impossible without it.
created_by and updated_by from session variables
Sometimes you just need to know who. David Wippel has this great, and easy to implement tip for adding customer audit paths to DB interactions. A real-world tip and trick that could go on any customer table.
Hasura without Docker
Sometimes you need to avoid the whale-of-a-resource-drain that certain infrastructure tooling in the community can be. If you’re looking for a stand-alone Hasura, for whatever reason, you can have your binary cake, without eating your memory, too. Thanks to the minimalist coder, aziez for closing out our list!
Whether you are writing custom functions for access-controls, auto applying SQL statements from source control, automating security infrastructure or diffing metadata deployments – the wealth of knowledge from these tips and tricks provide massive benefits to the whole community.
The winners have now been notified, and everyone should have received a message asking for the address to send some swag. If you haven’t received that message, do let us know!
Until next time, keep the tools sharp.