How I used Hashnode as a CMS
Published: 2022-04-20 04:52:16

All of you know I have a blog on [Hashnode](hashnode.com) 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](nibodhdaware.me), 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)

![gif](https://media.giphy.com/media/nrXif9YExO9EI/giphy.gif)

### 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](https://yourstory.com/2021/08/funding-hashnode-investors-valley-tech-experts-backing-blogging-startup/amp) 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

![gif](https://media.giphy.com/media/Qw4X3FmMTbUAgDfsbf2/giphy.gif)

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

## The solution

![gif](https://media.giphy.com/media/UKkes2qN2T70s/giphy.gif)

(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

{% embed https://www.youtube.com/watch?v=m0q4UhwNjrw %}

## The steps

![gif](https://media.giphy.com/media/r1RcZJDqhp7HZCGTXp/giphy.gif)

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: https://github.com/nibodhdaware/automate-blogs

Gear (New): https://nibodhdaware.me/gear