NextJS portfolio setting up - part 2

I'm a full-stack developer from South Africa 🇿🇦. I love writing about JavaScript, HTML and CSS.
Search for a command to run...

I'm a full-stack developer from South Africa 🇿🇦. I love writing about JavaScript, HTML and CSS.
No comments yet. Be the first to comment.
Now that we have our basic application set up, we can dive into the more detailed work. In part 1 I asked you to think about the global structure you are seeing, and in the template I picked, we got to know there were three designed pages. The commo...
Most of you know me for my consistency, a golden arrow in my blog series. I've written 1000 articles in 1008 days! Almost an article a day, and my honeymoon was the only holiday I ever took. I'm super proud of this achievement; it has been a fantasti...

It's not the first time I'll be talking about community. I think it's an essential aspect of any successful tool. This shows in my previous explorations of Astro, Medusa, and now Vendure as well. All these products thrive in a super open, welcoming, ...

The cool part about Vendure is how easy it is to set up and how abstract each layer is. Basically, we get the following elements: External database Server Worker Admin UI Frontend While this is amazing, it also brings a bit of complexity when it co...

The previous article looked at customizing Vendure on a data and process level. In this article, we'll look at customizing emails, as they are often a big part of a webshop system. We'll be looking at two different layers of customization for customi...

Even though Vendure is a pretty significant project out of the box, in some cases, we might want to go in and modify some elements to work to our specific use case. In this article, I'll take a high-level look at some elements we can customize within...

In the last part we had an overall look at what we would build, and I even gave you some homework to find an excellent design and analyze it into building blocks.
This article will look at setting up the project and installing all the dependencies we need.
The basic Next.js set up is quite forward these days, so let's run through it.
First, open your terminal and run the following command to create a new Next.js project.
npx create-next-app
Once done, it will install the project inside a folder whose name you picked in the CLI prompt.
Navigate to this folder (in my case, next-portfolio).
cd next-portfolio
If you are eager to see it work, run npm run dev to start up the server.
However, we will look into adding Tailwind CSS. First, Tailwind is an easy way to style the application neatly. You can also opt for regular CSS if you are unfamiliar with it.
First, install the needed dependencies:
npm install -D tailwindcss@latest postcss@latest autoprefixer@latest
After that, run the following command to initialize a tailwind config file.
npx tailwindcss init -p
Open the project in your favorite editor and find the tailwind.config.js file.
Add the pages and components config into the content part like this:
/** @type {import('tailwindcss').Config} */
module.exports = {
content: [
'./pages/**/*.{js,ts,jsx,tsx}',
'./components/**/*.{js,ts,jsx,tsx}',
],
theme: {
extend: {},
},
plugins: [],
};
Then we have to modify the styles/global.css to include the Tailwind imports.
@import 'tailwindcss/base';
@import 'tailwindcss/components';
@import 'tailwindcss/utilities';
While we are at it, also remove some of the things we won't be needing:
styles/Home.module.csspages/apiAnd let's modify our pages/index.js file to see if Tailwind is working.
import Head from 'next/head';
export default function Home() {
return (
<div>
<Head>
<title>NextJS Portfolio</title>
<meta name='description' content='Generated by create next app' />
<link rel='icon' href='/favicon.ico' />
</Head>
<main className='grid place-content-center min-h-screen'>
<div className='max-w-xs rounded overflow-hidden shadow-lg my-2'>
<div className='px-6 py-4'>
<div className='font-bold text-xl mb-2'>Next + Tailwind ❤️</div>
<p className='text-grey-darker text-base'>
Next and Tailwind CSS are a match made in heaven. Check out this
article on how you can combine these two for your next app.
</p>
</div>
</div>
</main>
</div>
);
}
Now run your app: npm run dev and visit http://localhost:3000/ to see it in action.

Alright, that's our setup for today! We created the project and added Tailwind to it.
Keep an eye out for tomorrow's article, where we'll dive into layouts in Next.js.
You can find the code for today on GitHub.
Thank you for reading my blog. Feel free to subscribe to my email newsletter and connect on Facebook or Twitter