A comprehensive book shop application built with React frontend and Node.js backend, featuring user authentication, book browsing, search functionality, and review system.
- β Get all books - Browse the complete book catalog (2 Points)
- β Search by ISBN - Find specific books using ISBN (2 Points)
- β Search by Author - Discover books by your favorite authors (2 Points)
- β Search by Title - Find books by title keywords (2 Points)
- β View book reviews - Read what others think about books (2 Points)
- β User Registration - Create a new account (3 Points)
- β User Login - Access your account (3 Points)
- β Add/Modify reviews - Share your thoughts about books (2 Points)
- β Delete reviews - Remove your own reviews (2 Points)
- β Get all books - Using async callback function (2 Points)
- β Search by ISBN - Using Promises (2 Points)
- β Search by Author - Using async/await (2 Points)
- β Search by Title - Using async/await (2 Points)
- Node.js - Runtime environment
- Express.js - Web framework
- JWT - Authentication
- bcryptjs - Password hashing
- Axios - HTTP client for API methods
- JSON Files - Data storage (books, users, reviews)
- React 18 - UI library
- React Router - Client-side routing
- Axios - API communication
- Context API - State management
- Modern CSS - Responsive design
bookshop/
βββ server.js # Main backend server
βββ package.json # Backend dependencies
βββ bookMethods.js # Node.js methods with different async patterns
βββ data/ # JSON data files
β βββ books.json # Book catalog
β βββ users.json # User accounts
β βββ reviews.json # Book reviews
βββ client/ # React frontend
β βββ package.json # Frontend dependencies
β βββ public/
β β βββ index.html
β βββ src/
β βββ App.js # Main app component
β βββ App.css # Global styles
β βββ index.js # Entry point
β βββ components/ # Reusable components
β β βββ Navbar.js
β β βββ BookCard.js
β β βββ ProtectedRoute.js
β βββ pages/ # Page components
β β βββ Home.js
β β βββ Login.js
β β βββ Register.js
β β βββ Search.js
β β βββ BookDetail.js
β β βββ Profile.js
β βββ context/ # React Context
β β βββ AuthContext.js
β βββ services/ # API services
β βββ api.js
βββ README.md
- Node.js (v14 or higher)
- npm or yarn
- Clone and install backend dependencies:
git clone <repository-url>
cd bookshop
npm install- Install frontend dependencies:
cd client
npm install
cd ..- Start the backend server:
npm start
# Server runs on http://localhost:5000- In a new terminal, start the frontend:
cd client
npm start
# Frontend runs on http://localhost:3000- Open your browser:
Navigate to
http://localhost:3000
GET /api/books- Get all booksGET /api/books/isbn/:isbn- Get book by ISBNGET /api/books/author/:author- Get books by authorGET /api/books/title/:title- Get books by titleGET /api/reviews/:isbn- Get reviews for a bookPOST /api/register- Register new userPOST /api/login- Login user
POST /api/reviews- Add/update book reviewDELETE /api/reviews/:isbn- Delete user's reviewGET /api/user/reviews- Get user's reviews
Run the Node.js methods demonstration:
node bookMethods.jsThis will demonstrate all four async patterns:
- Callback function for getting all books
- Promises for ISBN search
- Async/await for author search
- Async/await for title search
For testing purposes, use these credentials:
Email: [email protected]
Password: password123
Or register a new account!
- Responsive design that works on all devices
- Modern gradient navigation
- Card-based layout
- Smooth animations and transitions
- Loading states and error handling
- JWT-based authentication
- Password hashing with bcrypt
- Protected routes
- Persistent login sessions
- Star rating (1-5 stars)
- Add, edit, and delete reviews
- User-specific review management
- Review display with author and date
- Multiple search types (Title, Author, ISBN)
- Real-time search results
- Search suggestions and tips
- Error handling for no results
- Password hashing with bcrypt
- JWT token authentication
- Protected API endpoints
- Input validation
- XSS protection
The application is fully responsive and works on:
- Desktop computers
- Tablets
- Mobile phones
- Various screen sizes
For production deployment:
- Build the frontend:
cd client
npm run build- Serve built files from Express: Add this to your server.js:
app.use(express.static(path.join(__dirname, 'client/build')));- Set environment variables:
NODE_ENV=productionJWT_SECRET=your-production-secretPORT=your-production-port
- Fork the repository
- Create a feature branch
- Commit your changes
- Push to the branch
- Open a Pull Request
This project is licensed under the MIT License.
Total Points: 28/28 β
- General User Features: 14 Points
- Registered User Features: 4 Points
- Node.js Methods: 8 Points
- Modern React Implementation: 2 Points (Bonus)