Modern bookstore demo built with Next.js App Router, React, and Tailwind CSS. It showcases a catalog with filtering, featured carousel, book details with reviews, a simple cart (localStorage), and API route examples.
- Catalog UI: Grid and list views with search, genre filter, sorting, and pagination
- Featured Carousel: Simple paged carousel for highlighted books
- Book Details: Ratings renderer, genres, price, and a reviews section
- Cart (Client-only): Stored in
localStorage, synced across pages via a customcartUpdatedevent - API Routes: Example endpoints under
/api/booksand/api/cart - Responsive Design: Tailwind CSS v4 styles
- Framework: Next.js 15 App Router (
/src/app) - UI: React 19 + Tailwind CSS v4
- Language: TypeScript (strict mode)
- Install dependencies
npm install- Run the development server
npm run devVisit http://localhost:3000.
- Build and start (production)
npm run build
npm start- Lint
npm run lintsrc/
app/
api/
books/route.ts # GET all books (from static data)
cart/route.ts # Example GET/POST/PUT/DELETE cart endpoints (demo only)
book/[id]/page.tsx # Book details + reviews + add-to-cart
cart/page.tsx # Cart page (localStorage-backed)
components/ # UI components (grid, list item, navbar, pagination, etc.)
data/ # Static books and reviews data
layout.tsx # Root layout + navbar
page.tsx # Home page with featured + list
Public images live under public/images/ and are referenced by the seeded books.
npm run dev: Start Next.js in development modenpm run build: Create an optimized production buildnpm start: Start the production servernpm run lint: Run ESLint (flat config)
-
GET /api/books- Returns the full books array from
src/app/data/books.ts.
- Returns the full books array from
-
/api/cart(demo only)GET→ Returns a placeholder messagePOST→ Echoes received item payloadPUT→ Echoes updated item payloadDELETE?itemId=...→ Echoes removeditemId
These handlers illustrate API route structure; they do not persist data. For a real app, integrate a database (Prisma/Drizzle) and authentication.
- Books/Reviews: Sourced from static files in
src/app/data/. - Cart: Client-only. Stored in
localStorageunder keycartas an array of{ id, bookId, quantity, addedAt }.- Adding to cart dispatches
window.dispatchEvent(new CustomEvent('cartUpdated'))so theNavbarcan update its badge count. - The
cartpage reads items fromlocalStorageand maps them to book metadata.
- Adding to cart dispatches
- Next.js App Router: Pages/components live in
src/app/and many UI parts are client components ('use client'). - Tailwind CSS v4: Included via
@tailwindcss/postcssinpostcss.config.mjsand imported insrc/app/globals.css. - React 19: Uses the latest React. Ensure your tooling supports the listed versions in
package.json. - TypeScript: Strict settings enabled in
tsconfig.json. Paths alias@/*→src/*.
- Buttons/links use clear labels and focusable controls.
- Pagination includes
aria-labels and current-page states. - Visual feedback for cart actions (loading and success states).
- Any Node host is fine. For a smooth experience, deploy to Vercel:
- See Next.js docs: Deployment guide
- Or use Vercel dashboard to import the repo and deploy
This project is provided as a learning/demo resource. Add your preferred license here if distributing.