techhub

All about TechHub Daily's Architecture

We recently implemented something really interesting for the daily questions section of our website. Here's an overview of it.

Aditya Keshri (adikeshri)

Engineer | Problem Solver | Data geek

Old solution:
We had a firebase real-time database where we updated questions to reflect on the website. But there were few issues with this approach, the biggest one: since we were using a free plan, we had a quota limit and the website was running quite slowly when we load it up.

Additionally, we were dependent on google and were also manually updating questions every time. These were the major problem we wanted to solve.

New solution:
We started by actually automating the process of question selection, wrote a python script to update the data file with a new question (just from CodeChef for now) every time the script was run.

Now the script will automatically fetch the questions and update data.json, but how do we automate this process in the repository?

Github actions to the rescue, we added a bot account to run this script and commit to the same repository every time it ran and scheduled it to run at 9.30pm every day.

This essentially automated the entire process, of fetching and injecting, and committing. But we still needed to move this infrastructure away from firebase and to do that we used GitHub pages to host the entire project on a static page.

Now through our website, we just need to hit that page to fetch the questions. This even improved performance by a whole lot(you might have noticed :P)

Here is the repository link if you're interested in the implementation, or if you want to contribute something more, just add an issue.

Do check it out, this just one of many examples of how we can creatively solve problems with limited resources.

You can join us in our Discord Community. Be a part of the growing technology network where you can learn and exchange knowledge.