1. Docs
  2. Installation
  3. Next.js

Next.js

Install and configure Next.js.

Create project

Start by creating a new Next.js project using create-next-app:

Terminal

You will be asked a few questions to create the project:

Currently, I prefer to use Biome.js instead of ESLint. You can use ESLint if you prefer. Also I prefer to use ~ as the alias. You can use @ or any other alias if you prefer.

Run the shadcn CLI

Run the shadcn init command to setup your project:

Remove unused shadcn packages

Kanpeki uses modern tooling instead of shadcn's defaults. Remove packages you won't need:

Why? Kanpeki uses CVA beta and tailwindcss-motion instead. See the introduction for details.

Delete these files:

  • src/lib/utils.ts (optional - keep if you have other utilities)

Remove this import from src/styles/globals.css:

globals.css

That's it ✨

You can now start adding components to your project.

The command above will add the Button component to your project. You can then import it like this:

Fonts (optional)

I use Geist as the default font. You can use any font you like.

Here's how I configure Geist for Next.js:

1. Create a fonts.ts file inside src/config:

2. Import the font in the root layout:

3. Configure --font-sans in globals.css

globals.css

App structure

Here's how I structure my Next.js apps. You can use this as a reference:

components.json
next.config.ts
package.json
postcss.config.js
tsconfig.json
  • I place the UI components in the src/components/ui folder.
  • The lib folder contains configuration for external libraries.
  • The styles folder contains the global CSS.