Skip to content

saeedi404/booksland

Repository files navigation

Bookstore App

A modern bookstore application built with Next.js, Clerk authentication, and DaisyUI. Users can browse books and download PDFs after authentication.

Features

  • 📚 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

Getting Started

Prerequisites

  • Node.js 18+ installed
  • A Clerk account (free tier available at clerk.com)

Setup Steps

  1. Install dependencies:
npm install
  1. Configure Clerk Authentication:

    • Sign up at clerk.com and create a new application
    • Copy your Clerk keys from the dashboard
    • Create a .env.local file in the root directory:
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=pk_test_...
CLERK_SECRET_KEY=sk_test_...
  1. Run the development server:
npm run dev
  1. Open your browser:

Navigate to http://localhost:3000 to see the app.

Project Structure

  • app/ - Next.js app directory with pages and API routes
  • data/books.ts - Book data array (no database needed!)
  • public/books/ - PDF files stored here
  • middleware.ts - Clerk middleware for route protection

How It Works

  1. Users can browse all books on the homepage without authentication
  2. When clicking "Download PDF", users are redirected to sign in if not authenticated
  3. After authentication, users are redirected to the download page
  4. The PDF automatically downloads from the protected API route

Adding Books

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.

Technologies Used

  • Next.js 16 - React framework
  • Clerk - Authentication
  • DaisyUI - UI component library
  • Tailwind CSS - Styling
  • TypeScript - Type safety

Learn More

About

A fast, intuitive web app for discovering and downloading book PDFs. Built with modern web technologies and optimized for performance, this project provides a streamlined way to browse, search, and access a wide range of books in PDF format.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors