A modern bookstore application built with Next.js, Clerk authentication, and DaisyUI. Users can browse books and download PDFs after authentication.
- 📚 Browse books without authentication
- 🔐 Secure PDF downloads with Clerk authentication
- 🎨 Modern UI with DaisyUI components
- 📱 Responsive design for all devices
- 🚀 No database required - simple TypeScript array for book data
- Node.js 18+ installed
- A Clerk account (free tier available at clerk.com)
- Install dependencies:
npm install-
Configure Clerk Authentication:
- Sign up at clerk.com and create a new application
- Copy your Clerk keys from the dashboard
- Create a
.env.localfile in the root directory:
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=pk_test_...
CLERK_SECRET_KEY=sk_test_...- Run the development server:
npm run dev- Open your browser:
Navigate to http://localhost:3000 to see the app.
app/- Next.js app directory with pages and API routesdata/books.ts- Book data array (no database needed!)public/books/- PDF files stored heremiddleware.ts- Clerk middleware for route protection
- Users can browse all books on the homepage without authentication
- When clicking "Download PDF", users are redirected to sign in if not authenticated
- After authentication, users are redirected to the download page
- The PDF automatically downloads from the protected API route
Edit data/books.ts to add new books:
{
id: "6",
title: "Your Book Title",
body: "Book description...",
author: "Author Name",
filePath: "/books/your-book.pdf",
}Then add the corresponding PDF file to public/books/your-book.pdf.
- Next.js 16 - React framework
- Clerk - Authentication
- DaisyUI - UI component library
- Tailwind CSS - Styling
- TypeScript - Type safety