Modern Next.js setup
Next.js 16 brings major improvements: async request APIs, better caching primitives, and Turbopack for faster dev builds. Starting with the latest version and modern tooling sets you up for success.
Outcome
Create a fresh Next.js 16 app with TypeScript, Tailwind CSS, and shadcn/ui components installed and configured.
Fast Track
- Run
npx create-next-app@latest ai-review-summary(Yes to TypeScript, Tailwind, App Router; No tosrc/directory) - Run
npx shadcn@latest initthennpx shadcn@latest add card avatar separator - Replace
app/page.tsxwith a simple "Product Reviews" heading and runpnpm dev
Hands-on Exercise 1.1
Set up a modern Next.js development environment:
Requirements:
- Create a new Next.js 16 app with TypeScript and Tailwind CSS
- Configure the App Router
- Install shadcn/ui and add basic components (card, avatar, separator)
- Create folder structure:
lib/,components/,app/ - Run the dev server and verify it works
Implementation hints:
- Use
pnpmfor faster installs - Choose App Router when prompted
- Enable Turbopack for dev mode
- shadcn/ui requires a few config steps (see solution)
Step 1: Create Next.js App
npx create-next-app@latest ai-review-summaryConfiguration prompts:
✔ Would you like to use the recommended Next.js defaults? … Yes
cd ai-review-summaryStep 2: Install shadcn/ui
shadcn/ui provides beautifully designed components built with Radix UI and Tailwind.
npx shadcn@latest initConfiguration prompts:
✔ Preflight checks.
✔ Verifying framework. Found Next.js.
✔ Validating Tailwind CSS.
✔ Validating import alias.
✔ Which color would you like to use as the base color? › Neutral
This creates:
lib/utils.tswithcn()helper- Updates to
tailwind.config.ts
Step 3: Add Base Components
Install the components we'll need for the review app:
npx shadcn@latest add card avatar separatorThis adds:
components/ui/card.tsx- Card containercomponents/ui/avatar.tsx- User avatarscomponents/ui/separator.tsx- Dividers
Step 4: Clean Up Default Files
Remove the default Next.js boilerplate by replacing the content of the files with the following:
Update app/page.tsx:
export default function Home() {
return (
<main className="min-h-screen p-8">
<div className="max-w-4xl mx-auto">
<h1 className="text-4xl font-bold mb-4">Product Reviews</h1>
<p className="text-muted-foreground">
A modern Next.js app for displaying customer reviews
</p>
</div>
</main>
);
}Update app/layout.tsx:
export const metadata: Metadata = {
title: "AI Review Summary",
description: "Customer reviews powered by AI",
};Step 5: Run the Dev Server
pnpm devExpected output:
▲ Next.js 16.0.8 (Turbopack)
- Local: http://localhost:3000
- Network: http://192.168.1.5:3000
✓ Starting...
✓ Ready in 1.2s
Try It
-
Visit http://localhost:3000
-
You should see:
- "Product Reviews" heading
- Clean Tailwind styling
- No console errors
-
Test hot reload:
- Change the heading text in
app/page.tsx - Save the file
- Page updates instantly (Turbopack)
- Change the heading text in
-
Verify shadcn/ui works:
- Add a Card component to the page:
import { Card, CardHeader, CardTitle, CardContent } from "@/components/ui/card";
export default function Home() {
return (
<main className="min-h-screen p-8">
<div className="max-w-4xl mx-auto space-y-8">
<Card>
<CardHeader>
<CardTitle>Product Reviews</CardTitle>
</CardHeader>
<CardContent>
<p className="text-muted-foreground">
A modern Next.js app for displaying customer reviews
</p>
</CardContent>
</Card>
</div>
</main>
);
}- Verify the card displays with proper styling
Project Structure
Your app should now look like this:
ai-review-summary/
├── app/
│ ├── layout.tsx # Root layout with metadata
│ ├── page.tsx # Homepage
│ └── globals.css # Global styles (Tailwind)
├── components/
│ └── ui/ # shadcn/ui components
│ ├── card.tsx
│ ├── avatar.tsx
│ └── separator.tsx
├── lib/
│ └── utils.ts # Helper functions
├── next.config.ts # Next.js configuration
├── tailwind.config.ts # Tailwind configuration
├── tsconfig.json # TypeScript configuration
└── package.json # Dependencies
Understanding the Stack
Next.js 16:
- App Router for file-based routing
- Server Components by default (better performance)
- Turbopack for 10x faster dev builds
- React 19 with new async capabilities
TypeScript:
- Type safety across the entire app
- Better IDE autocomplete
- Catch errors before runtime
Tailwind CSS:
- Utility-first CSS framework
- No separate CSS files needed
- Responsive design out of the box
shadcn/ui:
- Copy/paste components (not a package dependency)
- Built on Radix UI primitives
- Fully customizable with Tailwind
Troubleshooting
npx shadcn@latest init fails with "Could not find a configuration file"
You're running the command from the wrong directory. Make sure you're in your project root (where package.json lives):
cd ai-review-summary
npx shadcn@latest initDone-When
- Next.js 16 app created with TypeScript and Tailwind
- App Router configured (not Pages Router)
- shadcn/ui installed with card, avatar, separator components
- Dev server runs without errors
- Basic folder structure in place
What's Next
Your development environment is ready. In the next lesson, you'll build a type-safe data layer with Zod schemas for products and reviews. This foundation will make the app reliable and easy to extend.
Sources:
Was this helpful?