A simple campus Book Exchange and Borrowing System built with HTML, CSS, JavaScript, Node.js, Express and MySQL.
- Student signup with name, student ID, department, phone, email and password
- Login, logout and protected application page
- 10 sample student accounts and 110 sample books for search and demonstration
- Add, publish, view, edit and delete books
- Newly published books appear immediately in Browse
- Search by title, author, category or description
- Send, approve, reject and cancel borrow requests
- Seven-day loan period
- Tk 10 fine per late day
- Session cookie and local-storage search preference
- Prepared SQL queries and try/catch error handling
BookSwap-Minimal-Fixed/
├── public/
│ ├── login.html
│ ├── signup.html
│ ├── app.html
│ ├── style.css
│ ├── auth.js
│ └── app.js
├── server.js
├── database.js
├── database.sql
├── package.json
├── .env.example
└── README.md
- Start Apache and MySQL in XAMPP.
- Open phpMyAdmin.
- Import
database.sql. This resets the oldbook_exchangedatabase and inserts sample data. - Copy
.env.exampleto.env. - Run
npm install. - Run
npm start. - Open
http://localhost:3000.
All 10 sample accounts use the password demo123.
nusrat@bookswap.demotanvir@bookswap.demofarhan@bookswap.demosadia@bookswap.demomahin@bookswap.demoayesha@bookswap.demorafi@bookswap.demosamira@bookswap.demoarif@bookswap.demonabila@bookswap.demo
The Browse page shows all available books, including the current user's published books. A user's own books are marked Your published book and cannot be requested by that same user.
After a loan is created, run this in phpMyAdmin:
UPDATE loans
SET due_date = DATE_SUB(CURDATE(), INTERVAL 3 DAY)
WHERE status = 'borrowed';Reload the Loans & Fines section. The current fine should be Tk 30.
- CREATE: Add a book
- READ: Browse/search books
- UPDATE: Edit an available book
- DELETE: Delete an available book
- 110 seeded books across many categories
- Dynamic quick-search buttons generated from database categories
- Users may type a new category when publishing a book
- Responsive layout for phones, tablets, laptops and desktop computers
- Footer on login, signup and application pages
users 1 ---- many books
users 1 ---- many borrow_requests
books 1 ---- many borrow_requests
users 1 ---- many loans as owner
users 1 ---- many loans as borrower
books 1 ---- many historical loans
Primary keys are the id columns. Foreign keys connect books.owner_id,
borrow_requests.book_id, borrow_requests.requester_id, and the three user/book
references in loans. The complete data types and constraints are available in
database.sql.
The included Git history contains 30 meaningful commits: 20 project/frontend commits followed by 10 backend, validation, database, and documentation commits. This satisfies the safest interpretation of the course requirement for at least 20 frontend pushes and at least 10 backend pushes.
Connect the empty repository:
git remote add origin https://github.com/ggvolta/BookSwap.gitThen push every commit separately:
powershell -ExecutionPolicy Bypass -File .\push-30-commits.ps1Never upload .env or node_modules. Both are excluded by .gitignore.