<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: White</title>
    <description>The latest articles on Forem by White (@white).</description>
    <link>https://forem.com/white</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F473844%2F18a29157-7de6-4d48-8955-027e2555827f.jpeg</url>
      <title>Forem: White</title>
      <link>https://forem.com/white</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/white"/>
    <language>en</language>
    <item>
      <title>A HackerNews clone built with Next.js and shadcn/ui</title>
      <dc:creator>White</dc:creator>
      <pubDate>Tue, 02 Apr 2024 02:56:47 +0000</pubDate>
      <link>https://forem.com/white/a-hackernews-clone-built-with-nextjs-and-shadcnui-e7</link>
      <guid>https://forem.com/white/a-hackernews-clone-built-with-nextjs-and-shadcnui-e7</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://github.com/WhiteDG/nextjs-hackernews"&gt;Next.js Hackernews&lt;/a&gt; is an open-source hackernews clone written in TypeScript and built with Next.js and shadcn/ui.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Utilizes the latest Next.js features, including App Router, RSC, and Server Action.&lt;/li&gt;
&lt;li&gt;With a stunning UI powered by shadcn/ui, it seamlessly adapts to both desktop and mobile environments, providing an exceptional user experience.&lt;/li&gt;
&lt;li&gt;Data is retrieved from various sources, including the official API](&lt;a href="https://github.com/HackerNews/API"&gt;https://github.com/HackerNews/API&lt;/a&gt;), &lt;a href="https://news.ycombinator.com/"&gt;official website&lt;/a&gt;, and &lt;a href="https://hn.algolia.com/api"&gt;HnAlgolia API&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Feel free to explore a &lt;a href="https://nextjs-hackernews-omega.vercel.app/"&gt;live demo&lt;/a&gt;!&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Features
&lt;/h2&gt;

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

&lt;h2&gt;
  
  
  Screenshots
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Desktop
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fl71fslm3763mv5lhsjyt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fl71fslm3763mv5lhsjyt.png" alt="index-desktop" width="800" height="406"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2uofp4lxhcqrbuv2eer9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2uofp4lxhcqrbuv2eer9.png" alt="story-desktop" width="800" height="1214"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqoi6d4b7tuk1tqu05l4i.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqoi6d4b7tuk1tqu05l4i.png" alt="upvoted-desktop" width="800" height="406"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fc16uv4vl01jwf2n9ckmv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fc16uv4vl01jwf2n9ckmv.png" alt="login-desktop" width="800" height="406"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Mobile
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7btddta0lmhgabn8pklv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7btddta0lmhgabn8pklv.png" alt="index-mobile" width="700" height="1270"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8iqueuqwpjz1dqr38zeg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8iqueuqwpjz1dqr38zeg.png" alt="story-mobile" width="700" height="1270"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9rpmgn01glp0n1vfa7g3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9rpmgn01glp0n1vfa7g3.png" alt="upvoted-mobile" width="700" height="1270"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fy3ce5ep3xooxl2tlhpjq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fy3ce5ep3xooxl2tlhpjq.png" alt="login-mobile" width="700" height="1270"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Running Locally
&lt;/h2&gt;

&lt;p&gt;Requires Node.js 18.17 or later.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Clone the project.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git clone https://github.com/WhiteDG/nextjs-hackernews.git

&lt;span class="nb"&gt;cd &lt;/span&gt;nextjs-hackernews
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Install dependencies.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pnpm &lt;span class="nb"&gt;install&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Copy &lt;code&gt;.env.example&lt;/code&gt; to &lt;code&gt;.env.local&lt;/code&gt; and update the variables.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cp&lt;/span&gt; .env.example .env.local
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Run the development server with hot reload.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pnpm dev
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Open &lt;a href="http://localhost:3000"&gt;http://localhost:3000&lt;/a&gt; with your browser to see the result.&lt;/li&gt;
&lt;li&gt;Build for production
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pnpm run build
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Serve in production mode
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pnpm start
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For more information, see: &lt;a href="https://github.com/WhiteDG/nextjs-hackernews"&gt;https://github.com/WhiteDG/nextjs-hackernews&lt;/a&gt;&lt;/p&gt;

</description>
      <category>nextjs</category>
      <category>react</category>
      <category>typescript</category>
      <category>showdev</category>
    </item>
  </channel>
</rss>
