Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

Β 

History

1 Commit

Folders and files

Repository files navigation

My Library - Full-Stack Web Application

A modern, feature-rich web application for managing your personal book library. Built with Next.js, NestJS, PostgreSQL, and Prisma.

πŸš€ Features

Core Functionality

  • βœ… User Authentication - Secure JWT-based authentication with refresh tokens
  • πŸ“š Book Management - Add, edit, delete, and organize your book collection
  • πŸ“– Reading Progress Tracking - Track pages read and reading progress
  • ⭐ Rating System - Rate your books from 1-5 stars
  • πŸ“ Personal Notes - Add notes for each book
  • 🏷️ Genre Organization - Categorize books by genre
  • πŸ” Smart Search - Search by title, author, or ISBN
  • πŸ“Š Dashboard Analytics - View reading statistics and progress
  • πŸŒ™ Dark Mode - Beautiful dark/light theme toggle
  • πŸ“± Responsive Design - Works perfectly on desktop, tablet, and mobile

Advanced Features

  • πŸ”Œ Google Books API Integration - Auto-fill book details by searching
  • 🎯 Filtering & Sorting - Filter by status, sort by various criteria
  • πŸ“ˆ Reading Statistics - Track your reading journey with charts
  • 🎨 Modern UI - Built with Tailwind CSS and ShadCN/UI components
  • ⚑ Real-time Updates - Instant UI updates with React Query
  • πŸ” Secure - Password hashing, rate limiting, and protected routes

πŸ“‹ Tech Stack

Frontend

  • Framework: Next.js 15 (App Router)
  • Language: TypeScript
  • Styling: Tailwind CSS
  • UI Components: ShadCN/UI
  • State Management: Zustand
  • Data Fetching: TanStack Query (React Query)
  • Form Handling: React Hook Form + Zod
  • Theme: next-themes

Backend

  • Framework: NestJS
  • Language: TypeScript
  • Database: PostgreSQL
  • ORM: Prisma
  • Authentication: JWT + Passport
  • Validation: class-validator
  • Security: Helmet, Rate Limiting, CORS

πŸ› οΈ Prerequisites

Before you begin, ensure you have the following installed:

  • Node.js 18.x or higher
  • npm or yarn
  • PostgreSQL 14.x or higher
  • Git

πŸ“¦ Installation & Setup

1. Clone the Repository

git clone <repository-url>
cd my-library

2. Backend Setup

cd backend

# Install dependencies
npm install

# Configure environment variables
cp .env.example .env
# Edit .env and update the DATABASE_URL and other settings

# Generate Prisma Client
npx prisma generate

# Run database migrations
npx prisma migrate dev

# (Optional) Seed the database with sample data
npm run seed

# Start the backend server
npm run start:dev

The backend API will be available at http://localhost:3001/api

3. Frontend Setup

cd frontend

# Install dependencies
npm install

# Configure environment variables
# Create .env.local file (already provided)

# Start the development server
npm run dev

The frontend will be available at http://localhost:3000

πŸ”§ Environment Variables

Backend (.env)

# Database
DATABASE_URL="postgresql://username:password@localhost:5432/my_library?schema=public"

# JWT Configuration
JWT_SECRET="your-super-secret-jwt-key"
JWT_REFRESH_SECRET="your-super-secret-refresh-jwt-key"
JWT_EXPIRATION="15m"
JWT_REFRESH_EXPIRATION="7d"

# Application
PORT=3001
NODE_ENV="development"

# CORS
FRONTEND_URL="http://localhost:3000"

# Google Books API (Optional)
GOOGLE_BOOKS_API_KEY="your-google-books-api-key"

Frontend (.env.local)

NEXT_PUBLIC_API_URL=http://localhost:3001/api
NEXT_PUBLIC_APP_NAME="My Library"

πŸ“Š Database Schema

The application uses the following database models:

  • User - User accounts with authentication
  • RefreshToken - JWT refresh tokens
  • Genre - Book genres/categories
  • Book - Book information and metadata
  • ReadingProgress - Track reading progress over time
  • Note - Personal notes for books

See backend/prisma/schema.prisma for the complete schema.

🎯 API Endpoints

Authentication

  • POST /api/auth/signup - Create new account
  • POST /api/auth/login - Sign in
  • POST /api/auth/refresh - Refresh access token
  • POST /api/auth/logout - Sign out
  • GET /api/auth/me - Get current user

Books

  • GET /api/books - Get all user books (with filters, search, sorting)
  • GET /api/books/:id - Get single book
  • POST /api/books - Create new book
  • PATCH /api/books/:id - Update book
  • DELETE /api/books/:id - Delete book
  • GET /api/books/statistics - Get reading statistics

Progress & Notes

  • POST /api/books/:id/progress - Update reading progress
  • GET /api/books/:id/progress - Get progress history
  • POST /api/books/:id/notes - Add note
  • GET /api/books/:id/notes - Get all notes
  • DELETE /api/books/:id/notes/:noteId - Delete note

Genres

  • GET /api/genres - Get all genres
  • POST /api/genres - Create genre
  • PATCH /api/genres/:id - Update genre
  • DELETE /api/genres/:id - Delete genre

Google Books

  • GET /api/google-books/search?q=query - Search books
  • GET /api/google-books/isbn?isbn=123 - Get book by ISBN

πŸš€ Production Deployment

Backend

# Build the application
npm run build

# Run migrations in production
npx prisma migrate deploy

# Start the production server
npm run start:prod

Frontend

# Build for production
npm run build

# Start the production server
npm start

Deployment Platforms

  • Frontend: Vercel, Netlify, AWS Amplify
  • Backend: Railway, Render, Heroku, AWS EC2
  • Database: Railway, Supabase, AWS RDS, DigitalOcean

πŸ“ Usage Guide

Getting Started

  1. Sign Up: Create a new account at /signup
  2. Add Books:
    • Click "Add Book" button
    • Search using Google Books API or add manually
    • Fill in book details and save
  3. Manage Library:
    • View all books in "My Library"
    • Filter by status (Reading, Completed, Want to Read)
    • Search by title, author, or ISBN
    • Sort by various criteria
  4. Track Progress:
    • Click on a book to edit
    • Update reading status and pages read
    • Add personal notes and ratings
  5. View Statistics:
    • Check the Dashboard for reading analytics
    • See top genres and reading progress

πŸ” Security Features

  • Password hashing with bcrypt
  • JWT access tokens (15 min expiration)
  • Refresh tokens (7 day expiration)
  • Rate limiting (100 requests per minute)
  • CORS protection
  • Helmet security headers
  • Input validation
  • Protected API routes

🎨 UI/UX Features

  • Clean, modern Material Design-inspired interface
  • Smooth animations and transitions
  • Loading states and skeletons
  • Toast notifications for user feedback
  • Responsive grid layouts
  • Mobile-friendly navigation
  • Accessible components (ARIA labels)

πŸ§ͺ Testing

# Backend tests
cd backend
npm run test
npm run test:e2e

# Frontend tests
cd frontend
npm run test

🀝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

πŸ“„ License

This project is open source and available under the MIT License.

πŸ™ Acknowledgments

  • Google Books API for book data
  • ShadCN for beautiful UI components
  • Next.js and NestJS teams for excellent frameworks

πŸ“ž Support

For issues, questions, or suggestions, please open an issue on GitHub.


Built with ❀️ using modern web technologies

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages