A full-stack web application for managing an online bookstore with user authentication, book management, and recommendation features.
- User Management: Registration, login, and password reset with admin authentication
- Book Catalog: Complete CRUD operations for books with search and filtering
- Google Books API Integration: Search and import books from Google Books
- Recommendation System: Users can suggest books for the store
- Admin Panel: Special admin interface for managing books and users
- Caching: Redis integration for improved performance
- Responsive Design: Modern UI with Material-UI components
- Node.js with Express.js framework
- MongoDB with Mongoose ODM
- Redis for caching
- bcrypt for password hashing
- CORS for cross-origin requests
- Compression middleware for optimized responses
- React 18 with modern hooks
- Vite for fast development and building
- Material-UI (MUI) for component library
- React Router for navigation
- Axios for API communication
- React Hot Toast for notifications
Before running this project, make sure you have:
- Node.js (v16 or higher)
- MongoDB (local installation or MongoDB Atlas)
- Redis server
- npm or yarn package manager
git clone https://github.com/BlackJack-14/BookStore.git
cd BookStore# Install root dependencies
npm install
# Install backend dependencies
cd backend
npm install
# Install frontend dependencies
cd ../frontend
npm installCreate a .env file in the backend directory:
PORT=8000
MONGODB_URL=your_mongodb_connection_string
REDIS_URL=redis://127.0.0.1:6379
NODE_ENV=developmentUpdate backend/config.js with your MongoDB URL:
export const PORT = 8000;
export const mongoDBURL = 'your_mongodb_connection_string';Make sure MongoDB and Redis are running on your system.
# From the root directory - starts both backend and frontend
npm run dev# Start backend (from backend directory)
npm run dev
# Start frontend (from frontend directory)
npm run devThe application will be available at:
- Frontend: http://localhost:5173
- Backend API: http://localhost:8000
GET /books- Get all books (with Redis caching)GET /books/reset- Reset cache and fetch from databaseGET /books/:isbn- Get book by ISBNPOST /books- Add new book (admin only)PUT /books/:isbn- Update book by ISBNDELETE /books/:isbn- Delete book by ISBN
POST /users/register- Register new user (requires admin code: 8888)POST /users/login- User loginPOST /users/forgotPassword- Reset password (requires admin code)
GET /recommendations/:user- Get user recommendationsPOST /recommendations- Create new recommendationPUT /recommendations/:user- Update recommendationDELETE /recommendations/:user- Delete recommendation
- Navigate to the registration page
- Enter email, password, and admin code (8888)
- Submit to create account
- Login with admin email (admin@gmail.com)
- Access admin panel for book management
- Add books manually or search Google Books API
- Manage user recommendations
- Search books by title, author, or publication year
- Add books with complete metadata (Title, Author, Year, ISBN, Image, Amazon URL)
- Edit existing book information
- Delete books from catalog
- Users can recommend books to be added to the store
- Admins can view and manage recommendations
- Track recommendation status and descriptions
BookStore/
βββ backend/
β βββ models/
β β βββ bookModel.js # Book schema
β β βββ userModel.js # User schema
β β βββ suggestedBookModel.js # Recommendation schema
β βββ routes/
β β βββ bookRoute.js # Book API routes
β β βββ userRoute.js # User API routes
β β βββ suggestedBookRoute.js # Recommendation routes
β βββ utils/
β βββ config.js # Database configuration
β βββ index.js # Main server file
βββ frontend/
β βββ src/
β β βββ Components/ # Reusable React components
β β βββ pages/ # Page components
β β β βββ adminHomePage/ # Admin dashboard
β β β βββ homePage.jsx # User home page
β β β βββ loginPage/ # Authentication
β β β βββ addBookPage/ # Add new books
β β β βββ editBookPage/ # Edit existing books
β β β βββ recommendationPage/ # Book recommendations
β β βββ App.jsx # Main app component
β β βββ main.jsx # React entry point
β βββ package.json
βββ package.json # Root package.json
npm testcd frontend
npm run lintcd frontend
npm run build- Fork the repository
- Create a feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the ISC License.
- Admin code for registration and password reset:
8888 - Default admin email:
admin@gmail.com - Books are cached in Redis for 1 hour to improve performance
- Google Books API integration allows importing book data automatically