Create a GraphQL API in 60 Seconds — With No Code — Using Hasura
Get a nearly instant GraphQL engine without writing any code
What Is Hasura?
Hasura is an open-source project that connects your databases and microservices and instantly gives you a production-ready GraphQL API.
Reduce your time to go live by giving your team a powerful real-time GraphQL API in seconds from your PostgreSQL database.
The project is completely open source on GitHub, with new improvements coming out every week.
You can get more than 1,000 queries/sec with 50MB RAM — just with a container on a free Heroku dyno.
You can integrate and interact with microservices, connecting them by webhooks based on database events or merging multiple GraphQL external end points.
You get fully compatible subscriptions, which means you can get instant updates of the data from your back end to your front end thanks to WebSocket without having to handle anything except for writing the GraphQL query to get the data.
You can get all of that ready in less than one minute — or 60 seconds.
Let’s Get Started!
Just press “Deploy to Heroku.” This will automatically add a new app to your account and will also configure a free PostgreSQL database for you.
If you don’t have an account on Heroku, you need to sign up for one. You won’t need a credit card, and once you sign up, you’ll be redirected to your Heroku-app creation page automatically.
All these steps on Heroku will require around 30 seconds, so we still have 30 seconds to prepare Hasura.
Let’s Add Some Info to Your Database
- Add Star Wars SQL: Go to the DATA tab, and you’ll add the SQL from there.
Remember: Tick the “Track this” checkbox to automatically add these tables to the ones handled by Hasura without having to manually add them.
2. Relationships: After having added the tables, you’ll have to do one last thing: adding the relationships to each table so you’ll be able to query the tables nesting together with the data based on foreign keys.
3. Let’s make a query: Go on the GraphQL page, insert this query, and press the play button to show the results of these two tables merged together.
Let’s Make a GraphQL Query From Your Front End
Let’s show this data from your front end. I’ll use a modified version of a simple React app with Apollo Client from this tutorial.
Remember to replace the URL of the GraphQL server with the URL of your Heroku application URL, in my case
Complete code sanbox with data from Hasura:
Secure your Hasura end point like the warning message on the top right of Hasura reminds you to do it.
You can add a user authentication. I suggest you use Firebase because they don’t have any hard limit on the number of users you can have in your app.
Then, you could also try to add an external end point to your Hasura instance by going to the Remote Schemas tab.
After that, you could link every update to a row of your table with an invocation of the microservice to check if the user input contains spam or phishing words.
Resources and References: