How I Gave A Modern Look For HackerNews Feed

Full-Stack Developer, Entrepreneur and Co-Founder of Coderplex.
Building https://coderplex.in
Checkout my portfolio at https://bhanuteja.dev
Search for a command to run...

Full-Stack Developer, Entrepreneur and Co-Founder of Coderplex.
Building https://coderplex.in
Checkout my portfolio at https://bhanuteja.dev
Thanks a lot Sean
Hey, thanks for the feedback. Yeah, this is on my todo list. I also wanted to grey out the left part when the comments panel is opened. And another thing I wanted to do as I also said in the article is to replace the substring search with a fuzzy search. I will get to all of these soon.
Feel free to anything else you might want to see implemented. Someone on Reddit suggested me to implement a functionality to follow a thread. This might be a very big feature, so probably going to take a long time to implement this. So, I am not going to get to this follow thread feature anytime soon.
Thanks ๐. I didn't know if this kind of format will be received well. Just experimented with it. I will do show-casing of more of my projects every Saturday.
In this series, I will showcase some of the web development projects and challenges that I do every week.
Hello World ๐ Welcome to another project showcase. This time, I will be showing the GitHub Jobs project that I did very recently. The design is from FrontendMentor.Io. The website is available at jobs.bhanuteja.dev. Let's start with some visuals of...
Authored in connection with the Write With Fauna program. Table of Contents Authentication Setting up Fauna in Next.js Installing Fauna Setting up Migrations Tool Authentication and Authorization in Fauna Next.js Serverless Function Setup for Fa...

I wanted to start blogging in Aug of 2020. I decided to use @hashnode for my blog. It was the best decision that I made. I wrote 27 technical articles so far. Most of them are about frontend web development. A thread ๐งต about each of these articles i...

Next.js has become my go-to framework for almost every project that I make. So, I made a starter template that I can just use and get started easily. In this article, I will show you how to use the starter template that I made and deploy it with Verc...

In this article, I will list out all the git commands that I use very frequently. This is not in any way a complete list, just the commands that I use very often. This is intended to be used as a quick reference to perform an action that you want. ...

In this article, we will see the order in which different useEffect callbacks and cleanups happen. We will also see how it differs when the app mounts, unmounts, updates. This image is taken from https://github.com/donavon/hook-flow. I took the ex...

Bhanu Teja Pachipulusu's blog
29 posts
Developer, Indie Maker and Blogger. Currently building MDX.one
Checkout my portfolio
I made a website showing Hacker News and gave it a modern look. Before we dive into what all I used to make it, let's see some visuals of how the website looks. By the way, the website is at hn.bhanuteja.dev.
Let's get to it.
Here are the screenshots of the website at various screen sizes.







Looks clean, right? I like it. If you want to play around with it, visit https://hn.bhanuteja.dev
This project is built using Next.js, Tailwind, and React Query. There are different components to this website, let's see each one of them below.
I wanted to support the following use-cases. Anything extra is an added bonus
We need an API that does the following things:
I ended up using the official API which does 3 of the 4 things that I mentioned above. It doesn't have an API to fetch stories based on the search query. I decided to just implement the search functionality separately on the website itself based on the content fetched.
I used the following things for the UI.
I found an amazing package called javascript-time-ago which is a highly customizable relative date/time formatted. I used this to show the relative dates and times like 3 mins ago, 23 hrs ago etc.
I used Tailwind CSS animations utilities to show the loading skeleton.

I implemented pagination a little unconventionally. I have added infinite scrolling with the Load More button. But I also added page numbers to the website. When you click on a page, the page scrolls down to the first story of that page. I added this to have easy navigation when you load a large number of stories. Check the above gif to understand better.
I have added three types of filters.
This is a little bit tricky. The comments that we get from API is not just pure text. We get HTML content as the comment text. To style that, I have used @tailwindcss/typography plugin. If you don't know what it is, you should definitely check it out.
The search functionality that is present right now is very basic. It just does substring matches and filters the results. I am planning to instead use Fuse.js to do fuzzy searching(approximate string matching). Will get to this when I find the time.
The main challenge that I faced is because of API. The API has an endpoint that gives the story ids of approximately 500 stories. Then it has another endpoint that gives the details of a single story.
So, if I fetch all the stories at the page load, it was taking approximately 3-4 mins to fetch everything. Until we fetch everything, the filters wouldn't work. So I have to hide the filters until everything is fetched.
So, I made a compromise and decided to fetch just 50 stories at the start, and added a load more button. And I decided not to show a blank page until all stories are fetched. I immediately showed a story if it is fetched and showed a loading skeleton for the stories that are still being fetched. I hid the filters and added a loading rotating ring in place of that.
I faced some more challenges when I actually sat down to code. Especially because I wanted to show the story on the page as soon as it is fetched, instead of waiting for other stories to be fetched.
I made the code for this open-source. You can take a look at it, star it, fork it, make issues, raise PRS, do whatever you want with it.
Tell me in the comments if you like me to dig deep into any of the things that I discussed in this article. I will be happy to do so.
Here is the repo ๐ pbteja1998/hacker-news-client
Tell me in the comments if you like to see more articles in this format.
The next article will be part of the My Review of Kent C. Dodds's EpicReact.Dev series. It will be the third article in the series. To know more, go to My Review of Kent C. Dodds's EpicReact.Dev series.
If this was helpful to you, Please Like and Share so that it reaches others as well. To get email notifications on my latest articles, please subscribe to my blog by hitting the Subscribe button at the top of the page. You can also follow me on Twitter @pbteja1998.