DEV Community

Cover image for A HackerNews clone built with Next.js and shadcn/ui
White
White

Posted on

A HackerNews clone built with Next.js and shadcn/ui

Introduction

Next.js Hackernews is an open-source hackernews clone written in TypeScript and built with Next.js and shadcn/ui.

  • Utilizes the latest Next.js features, including App Router, RSC, and Server Action.
  • With a stunning UI powered by shadcn/ui, it seamlessly adapts to both desktop and mobile environments, providing an exceptional user experience.
  • Data is retrieved from various sources, including the official API](https://github.com/HackerNews/API), official website, and HnAlgolia API.
  • Feel free to explore a live demo!

Features

  • Next.js App Router
  • React Server Components (RSCs) and Suspense
  • Server Actions for mutations
  • Beautifully designed components from shadcn/ui
  • Styling with Tailwind CSS
  • Browse stories: Top, Newest, Best, Show, Ask, Jobs.
  • Search for stories.
  • User authentication: Create an account or log in using your Hacker News account to access personalized features.
  • Mark stories as favorite.
  • Upvote stories or comments.
  • Add comments.
  • View user profile: About, Submitted, Comments, Favorites, Upvoted(private).
  • Responsive design: Friendly to both mobile and desktop.
  • Automatic light/dark mode based on system settings.

Screenshots

Desktop

index-desktop

story-desktop

upvoted-desktop

login-desktop

Mobile

index-mobile

story-mobile

upvoted-mobile

login-mobile

Running Locally

Requires Node.js 18.17 or later.

  • Clone the project.
git clone https://github.com/WhiteDG/nextjs-hackernews.git

cd nextjs-hackernews
Enter fullscreen mode Exit fullscreen mode
  • Install dependencies.
pnpm install
Enter fullscreen mode Exit fullscreen mode
  • Copy .env.example to .env.local and update the variables.
cp .env.example .env.local
Enter fullscreen mode Exit fullscreen mode
  • Run the development server with hot reload.
pnpm dev
Enter fullscreen mode Exit fullscreen mode
pnpm run build
Enter fullscreen mode Exit fullscreen mode
  • Serve in production mode
pnpm start
Enter fullscreen mode Exit fullscreen mode

For more information, see: https://github.com/WhiteDG/nextjs-hackernews

Top comments (1)

Collapse
 
jameyhenry profile image
JameyHenry

Exciting to see a HackerNews clone leveraging Next.js and shadcn/ui for a modern and interactive user experience!
Fairplay