This project is a full-stack "Local Library Portal" for a fictional small-town library. It allows users to browse books, register/login, borrow books with restrictions, write reviews, and see their borrowed books.
- Public users can view and filter available books.
- Registered users can borrow up to 3 books, but not two from the same genre at once.
- Reviews include a learning reflection field.
- JWT-based authentication for secure login and registration.
- Custom middleware logs book borrowing events.
- Borrowed books show a due date formatted as DD-MMM-YYYY.
- Frontend: React.js
- Backend: Node.js + Express
- Authentication: JWT
- Storage: In-memory arrays (mock DB)
- Styling: Tailwind CSS (optional)
- Navigate to the backend folder (if separated) or project root.
- Run
npm installto install dependencies. - Start the server:
node app.js(or your main server file name). The server runs on port 5000 by default.
- Navigate to the React app folder (e.g.,
srcor root if combined). - Run
npm installto install frontend dependencies. - Start React app:
npm start. - The frontend runs on port 3000 by default and communicates with backend via API calls.
POST /register- Register a new user.POST /login- Login and get JWT token.GET /books- View all books with optional filters: genre, author, rating.POST /borrow/:id- Borrow a book (protected route, requires JWT).GET /profile- View user profile (protected route).
- Users cannot borrow more than 3 books.
- Users cannot borrow two books from the same genre simultaneously.
- Borrowed books have a
borrowedUntildate 14 days from borrowing. - Custom middleware logs borrowing events with timestamps.
Your Name Jahnavi