A web-based platform where users can exchange books with one another. Built using Flask, MySQL, and Tailwind CSS, this system enables users to list books, request books from others, and manage borrow approvals — all within a points-based economy.
- User registration & login (with hashed passwords & sessions)
- List books you want to lend
- Browse books listed by other users
- Request to borrow books
- Approve or reject incoming requests for your books
- Point system to manage fair exchanges
- Book cover images via URL
- Clean and responsive UI using Tailwind CSS
- Backend: Python (Flask)
- Frontend: HTML, Jinja2, Tailwind CSS
- Database: MySQL (mysql-connector)
- Authentication: Session-based login with hashed passwords
CREATE TABLE users (
id INT AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(100),
email VARCHAR(100) UNIQUE,
password VARCHAR(255),
points INT DEFAULT 10
);CREATE TABLE books (
book_id INT AUTO_INCREMENT PRIMARY KEY,
title VARCHAR(255),
author VARCHAR(255),
description TEXT,
image_url TEXT,
owner_id INT,
FOREIGN KEY (owner_id) REFERENCES users(id)
);CREATE TABLE requests (
request_id INT AUTO_INCREMENT PRIMARY KEY,
book_id INT,
borrower_id INT,
status ENUM('pending', 'approved', 'rejected') DEFAULT 'pending',
request_date DATE,
decision_date DATE,
FOREIGN KEY (book_id) REFERENCES books(book_id),
FOREIGN KEY (borrower_id) REFERENCES users(id)
);-
Clone the repository
git clone https://github.com/your-username/book-exchange-platform.git cd book-exchange-platform -
Create and activate a virtual environment
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install dependencies
pip install -r requirements.txt
-
Setup MySQL Database
- Create a database called book_exchange
- Run the schema.sql script to create required tables
-
Configure DB credentials in db_config.py
db_config = { 'host': 'localhost', 'user': 'your_mysql_user', 'password': 'your_mysql_password', 'database': 'book_exchange' };
-
Run the app
python app.py
-
Visit http://localhost:5000 in your browser
- Passwords are hashed using werkzeug.security
- Session-based authentication ensures user security
- Add CSRF protection and input validation for production use
Veer Jain
Email: veertiarra123@email.com
LinkedIn
GitHub