How I used Hashnode as a CMS

How I used Hashnode as a CMS

All of you know I have a blog on Hashnode you might be reading this on hashnode too (unless someone has a hashnode bot to repost this on his own domain, then idk). And I also have it on my own domain, so what's the problem?

The problem (don't take it as if hashnode has problems, it doesn't these are just my own concerns)

1. My content is dependent on some other website

what if hashnode goes down?

what if the hashnode startup goes out of funding? (clearly, it won't also a side note hashnode is Indian I never noticed, good job India)

These were some of my thoughts that made me want to make this project, cliché right?

2. I am a developer

what is a better way to increase your skill level than to take on projects like such?

The solution

(if you want to skip, skip it's a blog post, not a video also there are some links at the end of the post to the code of the project)

I created a bot-type creature that will grab my posts from hashnode and store it in a database table with all the metadata of the posts like the publishing date, brief, slug, etc. see it in action here

The steps

This was one of the most fun projects that I have worked on in a long time and of course, it took time for me to learn all these new things.

first up I had to decide what stack to use, my most prominent and most practiced language is python so I thought of creating this with Flask, not Django as it is only backend related not full-stack.

but recently I have been having absolute fun making simple backend applications and testing different backend things with Nodejs, also I had just followed a tutorial on how to use Node with a MySQL database. and so with a good enough stack with Node and MySQL I began working on it.

secondly, I needed to know how to use the hashnode API works to get my posts from hashnode. apparently, hashnode uses Graphql which is a new way to get JSON data from an API after using gql I think you can get data with ease and you don't have to use .then or fetches everywhere it's clean.

Now as I had the data about my posts I can easily add them to my database I used code from the same tutorial using Node and MySQL together and the final result was the youtube video I have embedded above.

Conclusion

Apparently, this is the best way to learn to code it doesn't matter how many youtube videos you watch, blog posts you read to get better at code, making a small project (by small I mean a good developer can do this in a few hours) I am not a good developer but I am learning so is everyone no developer is best at everything (except ego) everyone is learning so should you.

Code: github.com/nibodhdaware/automate-blogs

Gear (New): nibodhdaware.me/gear

Did you find this article valuable?

Support Nibodh Daware by becoming a sponsor. Any amount is appreciated!