Skip to content

Shamarvey1/BookNest

Repository files navigation

๐Ÿ“š BookNest โ€“ Modern Full-Stack Book Reading Platform

Status Version License

A cutting-edge full-stack web application for discovering, reading, and managing books online. BookNest combines seamless reading experiences with premium features like bookmarks, reading progress tracking, and personalized reading goals.

Live Demo: book-nest-ashy.vercel.app


โœจ Recent Updates

  • Added the AI Reading Assistant for contextual book help inside the reader page.
  • Improved the reader layout for both desktop sidebar and mobile drawer use.
  • Expanded the README with extra showcase space for the chatbot screenshot.

๐Ÿท๏ธ Tech Stack

Frontend

React Vite CSS3 Router

Libraries: React Icons, Lucide React, Ant Design, React PageFlip

Backend

Node.js Express JWT Bcrypt

Libraries: Axios, Razorpay, CORS, Dotenv

Database & ORM

MongoDB Prisma

Deployment

Vercel Payment


๐Ÿ“– Table of Contents

  1. โœจ Features
  2. ๐Ÿ› ๏ธ Tech Stack
  3. ๐Ÿ“‚ Project Structure
  4. โš™๏ธ Installation & Setup
  5. ๐Ÿš€ Getting Started
  6. ๐Ÿ” API Endpoints
  7. ๐Ÿ’พ Database Schema
  8. ๐Ÿ“ Environment Variables
  9. Contributing
  10. ๐Ÿš€ Deployment
  11. ๐Ÿ“ License

โœจ Features

๐Ÿ‘ค Authentication & Authorization

  • โœ… User registration with email verification
  • โœ… Secure login with JWT tokens
  • โœ… Password hashing with bcryptjs
  • โœ… Protected routes with middleware
  • โœ… Auto-redirect for authenticated users
  • โœ… Session management

๐Ÿ“š Book Reading Experience

  • โœ… Browse & search books from external APIs
  • โœ… Full-screen custom reader page
  • โœ… Page-flip animation with React PageFlip
  • โœ… Save reading position in database
  • โœ… Book recommendations & discovery
  • โœ… Advanced book filtering & sorting
  • โœ… Responsive design for all devices

โญ Premium Features

  • โœ… Bookmark management (Create, Read, Update, Delete)
  • โœ… Reading goals & daily tasks
  • โœ… Reading progress tracking
  • โœ… Favorite books collection
  • โœ… Premium access lock system
  • โœ… Subscription management

๐Ÿ’ณ Payments & Subscriptions

  • โœ… Razorpay payment integration
  • โœ… Subscription plans
  • โœ… Plan upgrade/downgrade
  • โœ… Payment history
  • โœ… Automatic renewal handling

๐Ÿ‘ฅ User Profile & Management

  • โœ… User profile customization
  • โœ… Avatar upload
  • โœ… Bio/About section
  • โœ… Reading statistics
  • โœ… Account settings

๐ŸŽจ UI/UX Enhancements

  • โœ… Modern, clean interface
  • โœ… Dark/Light mode support ready
  • โœ… Loading skeletons for better UX
  • โœ… Toast notifications
  • โœ… Pagination for book lists
  • โœ… Real-time search

๐Ÿ“‚ Project Structure

Book_Nest/
โ”œโ”€โ”€ frontend/                  # React Vite application
โ”‚   โ”œโ”€โ”€ public/               # Static assets
โ”‚   โ”œโ”€โ”€ src/
โ”‚   โ”‚   โ”œโ”€โ”€ assets/           # Images, icons
โ”‚   โ”‚   โ”œโ”€โ”€ components/       # Reusable React components
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ BookCard/
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ SearchBar/
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ Layout/
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ Loader/
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ Toast/
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ ...
โ”‚   โ”‚   โ”œโ”€โ”€ pages/            # Page components
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ Home/
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ Login/
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ Signup/
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ ReaderPage/
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ Library/
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ Profile/
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ Writing/
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ premium/
โ”‚   โ”‚   โ”œโ”€โ”€ services/         # API service functions
โ”‚   โ”‚   โ”œโ”€โ”€ context/          # React Context API
โ”‚   โ”‚   โ”œโ”€โ”€ hooks/            # Custom React hooks
โ”‚   โ”‚   โ”œโ”€โ”€ config/           # Configuration files
โ”‚   โ”‚   โ”œโ”€โ”€ App.jsx
โ”‚   โ”‚   โ””โ”€โ”€ main.jsx
โ”‚   โ”œโ”€โ”€ package.json
โ”‚   โ””โ”€โ”€ vite.config.js
โ”‚
โ”œโ”€โ”€ back-end/                 # Express.js server
โ”‚   โ”œโ”€โ”€ controllers/          # Business logic
โ”‚   โ”‚   โ”œโ”€โ”€ authController.js
โ”‚   โ”‚   โ”œโ”€โ”€ bookController.js
โ”‚   โ”‚   โ”œโ”€โ”€ bookmarkController.js
โ”‚   โ”‚   โ”œโ”€โ”€ favoriteController.js
โ”‚   โ”‚   โ”œโ”€โ”€ paymentController.js
โ”‚   โ”‚   โ”œโ”€โ”€ premiumController.js
โ”‚   โ”‚   โ”œโ”€โ”€ profileController.js
โ”‚   โ”‚   โ”œโ”€โ”€ progressController.js
โ”‚   โ”‚   โ””โ”€โ”€ writingController.js
โ”‚   โ”œโ”€โ”€ routes/               # API routes
โ”‚   โ”‚   โ”œโ”€โ”€ authRoutes.js
โ”‚   โ”‚   โ”œโ”€โ”€ bookRoutes.js
โ”‚   โ”‚   โ”œโ”€โ”€ bookmarkRoutes.js
โ”‚   โ”‚   โ””โ”€โ”€ ...
โ”‚   โ”œโ”€โ”€ middleware/           # Express middleware
โ”‚   โ”‚   โ””โ”€โ”€ authMiddleware.js
โ”‚   โ”œโ”€โ”€ prisma/
โ”‚   โ”‚   โ””โ”€โ”€ schema.prisma     # Database schema
โ”‚   โ”œโ”€โ”€ config/
โ”‚   โ”‚   โ””โ”€โ”€ prisma.js
โ”‚   โ”œโ”€โ”€ utils/                # Helper functions
โ”‚   โ”‚   โ”œโ”€โ”€ jwt.js
โ”‚   โ”‚   โ”œโ”€โ”€ cache.js
โ”‚   โ”‚   โ””โ”€โ”€ paginate.js
โ”‚   โ”œโ”€โ”€ server.js             # Express server entry
โ”‚   โ”œโ”€โ”€ package.json
โ”‚   โ””โ”€โ”€ .env                  # Environment variables
โ”‚
โ”œโ”€โ”€ README.md
โ””โ”€โ”€ package.json

โš™๏ธ Installation & Setup

Prerequisites

  • Node.js (v16 or higher)
  • npm or yarn
  • MongoDB (Atlas or local)
  • Git

Step 1: Clone the Repository

git clone https://github.com/Shamarvey1/BookNest.git
cd Book_Nest

Step 2: Install Backend Dependencies

cd back-end
npm install

Step 3: Install Frontend Dependencies

cd ../frontend
npm install

Step 4: Setup Environment Variables

Backend .env file (back-end/.env):

PORT=5001
DATABASE_URL=mongodb+srv://username:password@cluster.mongodb.net/booknest
JWT_SECRET=your_jwt_secret_key_here
RAZORPAY_KEY_ID=your_razorpay_key_id
RAZORPAY_KEY_SECRET=your_razorpay_secret_key

Frontend Configuration (frontend/src/config/endpoint.js):

const API_URL = "http://localhost:5001/api";
export default API_URL;

๐Ÿš€ Getting Started

Running Backend Server

cd back-end
npm run dev

Server runs on: http://localhost:5001

Running Frontend Development

cd frontend
npm run dev

Frontend runs on: http://localhost:5173

Building for Production

Frontend:

cd frontend
npm run build
npm run preview

Backend:

cd back-end
npm start

๐Ÿ” API Endpoints

Authentication Routes /api/auth

Method Endpoint Description
POST /signup Register new user
POST /login Login user
GET /profile Get current user profile
PUT /update Update user profile

Books Routes /api/books

Method Endpoint Description
GET / Get all books
GET /:id Get book details
GET /search/:query Search books

Bookmarks Routes /api/bookmarks

Method Endpoint Description
GET / Get all bookmarks
POST / Create bookmark
PUT /:id Update bookmark
DELETE /:id Delete bookmark

Favorites Routes /api/favorites

Method Endpoint Description
GET / Get all favorites
POST / Add to favorites
DELETE /:id Remove from favorites

Writing Routes /api/writing

Method Endpoint Description
GET / Get reading tasks
POST / Create reading task
PUT /:id Update task
DELETE /:id Delete task

Progress Routes /api/progress

Method Endpoint Description
GET / Get reading progress
POST / Create progress entry
PUT /:id Update progress
DELETE /:id Delete progress

Payment Routes /api/payments

Method Endpoint Description
POST /create-order Create Razorpay order
POST /verify Verify payment
GET /history Payment history

Premium Routes /api/premium

Method Endpoint Description
GET /status Check premium status
POST /upgrade Upgrade to premium
POST /cancel Cancel subscription

Profile Routes /api/profile

Method Endpoint Description
GET / Get profile details
PUT / Update profile
POST /avatar Upload avatar

๐Ÿ’พ Database Schema

User Model

model User {
  id                   String
  name                 String
  email                String (unique)
  password             String (hashed)
  isPremium            Boolean
  plan                 String
  validTill            DateTime
  avatarUrl            String
  bio                  String
  bookmarks            Bookmark[]
  favorites            Favorite[]
  userBooks            UserBook[]
  readingProgresses    ReadingProgress[]
  createdAt            DateTime
}

Book Model

model Book {
  id              String
  title           String
  author          String
  coverImage      String
  description     String
  content         String
  totalPages      Int
  language        String
  bookmarks       Bookmark[]
  favorites       Favorite[]
  userBooks       UserBook[]
}

Related Models

  • Bookmark: User bookmarks for specific pages/books
  • Favorite: User's favorite books collection
  • ReadingProgress: Track reading progress per book
  • UserBook: User reading history

๐Ÿ“ Environment Variables

Backend Variables (back-end/.env)

PORT                    # Server port (default: 5001)
DATABASE_URL           # MongoDB connection string
JWT_SECRET             # Secret key for JWT tokens
RAZORPAY_KEY_ID        # Razorpay public key
RAZORPAY_KEY_SECRET    # Razorpay secret key
NODE_ENV               # Environment (development/production)

Frontend Variables

Configured in frontend/src/config/endpoint.js:

const API_URL = "http://localhost:5001/api";

๐Ÿ”„ Contributing

We welcome contributions! Here's how to help:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/YourFeature)
  3. Commit your changes (git commit -m 'Add YourFeature')
  4. Push to the branch (git push origin feature/YourFeature)
  5. Open a Pull Request

Coding Standards

  • Use meaningful variable and function names
  • Add comments for complex logic
  • Follow ESLint rules (run npm run lint)
  • Test before submitting PR

๐Ÿš€ Deployment

Frontend (Vercel)

  1. Push to GitHub
  2. Connect repository to Vercel
  3. Set environment variables
  4. Deploy automatically on push to main branch

Backend (Render or Railway)

  1. Create account on Render/Railway
  2. Connect GitHub repository
  3. Set environment variables
  4. Deploy from main branch

๐Ÿ”ฎ Future Enhancements

  • Advanced book recommendations using AI/ML
  • Social features (sharing, comments, ratings)
  • Reading clubs and community features
  • Offline reading mode
  • Audio narration support
  • Advanced analytics dashboard
  • Mobile app (React Native)
  • Dark mode implementation
  • Email notifications
  • Book discussion forums

๐Ÿ“ง Support & Contact

  • GitHub Issues: Report bugs
  • Email: [Contact author]
  • Documentation: [Wiki/Docs]

๐Ÿ“ License

This project is licensed under the ISC License - see the LICENSE file for details.


๐Ÿ‘จโ€๐Ÿ’ป Author

Shamarvey - Full Stack Developer


๐Ÿ™ Acknowledgments

  • External book APIs for book data
  • MongoDB for database hosting
  • Razorpay for payment processing
  • Vercel for frontend deployment
  • Open source community

Made with โค๏ธ by Shamarvey

npm start

๐Ÿ’ป Frontend Setup cd frontend npm install npm run dev

๐Ÿ” API (Auth) Signup

POST /api/auth/signup

{ "name": "Ajit", "email": "ajitlookforbest@gmail.com", "password": "123456" }

Login

POST /api/auth/login

{ "email": "ajitlookforbest@gmail.com", "password": "123456" }

Response: { "token": "JWT_TOKEN" }

๐Ÿ“ธ Screenshots ๐ŸŸฆ Landing Page

alt text

๐Ÿ“š Home Page

alt text

๐Ÿ“– Reader Page

alt text

๐Ÿค– AI Chatbot

alt text ๐Ÿš€ Future Enhancements

AI Book Summary Generator

Razorpay payment integration

User Profile Page

Book Upload (for creators)

Search + Filter + Pagination

Reading Statistics Dashboard

๐Ÿ‘จ๐Ÿปโ€๐Ÿ’ป Author

Ajit Kumar Prasad (Shamarvey) Full Stack Developer ๐Ÿ“ Rourkela, Odisha ๐Ÿ“ง Email: ajitlookforbest@gmail.com

About

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors