Installing the required packages
2025-11-16

Last time, we progressed to retrieving the blog title on the Next.js homepage. This time, we'll set up the environment by adding libraries and other tools we have on hand as we build the blog.

Add Icon Library

This time, we will be using Lucide React for the icons on the site.

Please execute the following command.

sh

There are also various other libraries available. Feel free to use them according to your preferences.

Install Storybook

We will enable the use of Storybook, a convenient tool for component management, in this project. The procedure will be carried out by referring to the following page.

When referring to previous articles, note that while there were errors in the postcss.config.mjs configuration at the time, these have been resolved with updates to Next.js (I've also added the same note to the previous articles).

Setup Storybook

At the root of your Next.js project, run the following command:

sh

Once installation is complete, Storybook will launch automatically. To launch it in future sessions, use the following command:

sh

It now starts up.

Image

Changes to Tailwind CSS files

The Tailwind CSS file used in Next.js is currently located at `apps/nextjs/app/globals.css`. Move it to `apps/nextjs/styles/globals.css`.

        • globals.cssold place
        • globals.cssnew place

Modify the code in Next.js that references this file.

apps/nextjs/app/layout.tsx

Also, make sure the preview.ts file in Storybook references the same file as above.

apps/nextjs/.storybook/preview.ts

Organize components and CSS

Next, delete the files provided as samples by Storybook and place the sample components.

First, change the folder name of the components included as Storybook samples from `apps/nextjs/stories` to `apps/nextjs/components`. Additionally, create a `storybook` folder to manage `stories.ts` files collectively.

        Since the component reference location has changed, please update the paths referenced in the following files.

        apps/nextjs/.storybook/main.ts

        Next, we'll place the sample files. Please use the following code as the component file.

        apps/nextjs/components/Hero.tsx

        Next, create the stories file.

        apps/nextjs/storybook/Hero.stories.ts

        Finally, we'll adjust the stylesheet. Add one stylesheet file.

        apps/nextjs/styles/hero.css

        Apply the styles from the above file to globals.css. Remove other code and make it as follows.

        apps/nextjs/styles/globals.css

        This time, we'll add sample images to the public directory. Since the image file paths are specified in `apps/nextjs/storybook/Hero.stories.ts`, please change the image paths if you upload any files.

        Check Functionality

        We will proceed to verify how the above changes are applied.

        Test about Storybook

        First, verify operation in Storybook. Please execute the following command.

        sh

        The Hero component is displayed as a sample as follows.

        Image

        Test about Next.js

        Next, we'll test it in Next.js. Since we haven't added this component yet, we'll add the Hero to the top page.

        First, load the component.

        apps/nextjs/app/page.tsx

        Next, to use this component, add the Hero section to the same file.

        apps/nextjs/app/page.tsx

        Everything is now ready. Launch the Next.js component.

        sh

        As shown below, we were able to utilize the component.

        Image

        Summary

        As I begin building this blog, I added Storybook right away since it'll be handy for managing components. I also added the icon library for the site at the start and am already using it as icons in the Hero section.

        The code up to this point is published on the following branch.