Building a bucket list ideas API with Hasura and GraphQL

Search for a command to run...

No comments yet. Be the first to comment.
Last year I wrote my year-end reflection for 2020. Reflecting on your year is to look back and note down the highs and lows, the things you liked, moments you experienced, and the lessons you learned. And I felt really good after reviewing my year. S...
2022 was a year full of learnings for me. It was about solving problems, lots of iterations, making solid fundamentals, and growing up as a person. Even though it feels like this year went really fast and I have a very vague memory of it, this is my ...

Finally, the wait is over. Last year I built and launched Tabwave, a mindful productivity chrome extension that replaces your browser's new tab. It has been my passion project for a long time. And now it has become even more mindful and beautiful. Af...

The modern web has evolved over the years with new tools and technologies. We are introduced to new approaches to rendering websites and apps. With the rise of frameworks like NextJs and Remix, SSR has gained a lot of popularity in the last few years...

If you are following me for a while you know I love building side projects. And every time I decided to build one, I didn't know how it will turn out in the end. But one thing is for sure, it all started with a half-baked idea. half baked idea? what...

Did you know you can create GraphQL APIs within minutes without writing a single line of code? Well, I didn't. Thanks to the Hasura X Hashnode hackathon. Now I know and so you will.
Hi there, In this blog post I will talk about why and how I built a public API for my open-sourced side project with GraphQL and Hasura.
When I was in college, I wanted to do lots of stuff outside my studies and college life. I wanted to explore more and try different things out. Things that I didn't even imagine I would ever be able to do. So I started researching and found out about the thing called bucket list.
I loved the idea of the bucket list. It's like a number of experiences or achievements that a person hopes to accomplish during their lifetime.
So I created my own bucket list which had around 20 things. And I am so glad that I was able to cross a few items from my bucket list. Like Solving a Rubik's cube, meeting my favorite Indian author, or visiting Marine Drive, Mumbai.

Okay, we got it Rutik, enough with the story. How is it relative here?
So a few months back I actually built a bucket list app for myself. I was trying out different tech stacks and thought of building bucket, an app to create and track my bucket lists again. But this time digitally. Now I do realize every other side project I built is somehow a solution for my own real problems.

It was nothing complex. Just a simple todo like app disguised as a bucket list app. It's built with React, TailwindCSS, and Firebase.
When Hashnode announced the Hasura hackathon, I started brainstorming ideas to build something. And I realized one of the pain points I had in my side project. While creating my own bucket list, I was running out of ideas. And I wished there was an API that gives a bucket list idea. Unfortunately, I couldn't find any good.
So what would a developer like me do? I built one.
So one weekend I started learning about Hasura and GraphQL. I have used GraphQL APIs before but never built one. And I was blown away by the fact that one can build APIs without much prior knowledge of the technology.

Hasura is an open-source project that connects your databases and instantly gives you a production-ready GraphQL API. It really does what it says. While the main idea of GraphQL is to POST a query to an HTTP endpoint, instead of hitting different HTTP endpoints for different resources.
I loved how It takes no time to get started. You don't have to go through hours of tutorials to build something with Hasura. To be honest, building APIs with Hasura seems like β¨ magic.

id, idea, and category columns respectively.
Here is a simple query that gives bucket list ideas with category creative
query MyQuery {
ideas(where: {category: {_eq: "creative"}}) {
id,
idea
}
}

And that's it. Without writing a single line of code, I built the API in no time.
Once I built the API, I was able to use it in the GraphiQL playground but it still wasn't accessible to the public. After reading some docs I figured out that using the HASURA_GRAPHQL_UNAUTHORIZED_ROLE env variables and user roles.
Also to test and try out the API one could use the GraphQL playground. But to make things easier and reduce the step of copy-pasting the endpoint and all, I deployed the integrated playground using graphql-playground-react.

Demo: https://bucketlist-api-playground.vercel.app/
Code: https://github.com/rutikwankhade/bucketlist-api-playground
Here comes the good part. Now I integrated this bucket list API in my side project that suggests different bucket list ideas based on different categories.


You can try it out here https://bucket.vercel.app/explore-ideas
It was fun implementing this simple application in my side project. I am definitely going to learn more about GraphQL and Hasura after this. This is my submission for the Hasura Hackathon. See you next time.