Build Bookstore App with Next.js and Tailwind CSS
Context
Create a simple bookstore app from scratch in an empty directory. The app features a book catalog (grid view) and individual book detail pages, powered by hardcoded mock data.
Tech Stack
- Next.js 15 (App Router)
- Tailwind CSS v4
- TypeScript
Project Structure
bookstore/
├── src/
│ ├── app/
│ │ ├── layout.tsx # Root layout with navbar
│ │ ├── page.tsx # Home — book grid catalog
│ │ ├── globals.css # Tailwind imports
│ │ └── books/
│ │ └── [id]/
│ │ └── page.tsx # Book detail page
│ ├── components/
│ │ ├── Navbar.tsx # Site header with logo/nav
│ │ └── BookCard.tsx # Card component for the grid
│ └── data/
│ └── books.ts # Mock book data + TypeScript types
├── public/ # (empty, Next.js default)
├── package.json
├── tsconfig.json
├── next.config.ts
└── tailwind.config.ts
Steps
- Scaffold Next.js project —
npx create-next-app@latest . --typescript --tailwind --eslint --app --src-dir --no-import-alias --use-npm - Create mock data —
src/data/books.tswith ~8 books (title, author, price, genre, description, cover image URL, rating) - Build BookCard component — cover image, title, author, price, rating; links to detail page
- Build Navbar component — logo/site name, link to home
- Build home page — responsive grid of BookCards with a heading
- Build book detail page —
/books/[id]with full book info (cover, title, author, price, genre, description, rating) - Polish styling — consistent Tailwind styling, hover effects, responsive layout
Mock Data Shape
type Book = {
id: string;
title: string;
author: string;
price: number;
genre: string;
description: string;
coverImage: string;
rating: number;
};
Cover images will use placeholder URLs from https://covers.openlibrary.org (real book covers, no API key needed).
Verification
npm run dev— app starts without errors- Home page shows a responsive grid of books
- Clicking a book card navigates to
/books/[id]with full details - Back navigation works from detail page
- Responsive layout works on mobile/tablet/desktop
Key features:
- Responsive grid layout (1 col mobile, 2 tablet, 3 laptop, 4 desktop)
- Hover animations on cards (lift + shadow + image zoom)
- Static generation with
generateStaticParamsfor all book detail pages notFound()handling for invalid book IDs- Sticky frosted-glass navbar
Run npm run dev to start the dev server at http://localhost:3000.