A full-stack web application built with Python Flask (backend) and React (frontend), connected to a MySQL database.
library-app/
│
├── backend/
│ ├── api.py ← Flask REST API (all routes)
│ ├── requirements.txt ← Python dependencies
│ └── db/
│ ├── __init__.py
│ └── connection.py ← MySQL connection
│
└── frontend/
├── package.json
├── public/
│ └── index.html
└── src/
├── index.js
└── App.js ← All React components (Books, AddMember, IssueBook, ReturnBook, IssuedBooks, Fines)
- Open
backend/db/connection.py - Replace these values:
host="localhost", user="root", # ← your MySQL username password="yourpassword", # ← your MySQL password database="library_db" # ← your database name
Make sure your existing MySQL database has these tables:
book,member,issue_record,fine,category,publisher,admin
cd library-app/backend
# Create virtual environment (recommended)
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt
# Start Flask server
python api.py✅ Backend runs at: http://localhost:5000
cd library-app/frontend
# Install dependencies
npm install
# Start React development server
npm start✅ Frontend runs at: http://localhost:3000
| Method | Route | Description |
|---|---|---|
| GET | /books | Fetch all books |
| POST | /add_member | Add a new member |
| POST | /issue_book | Issue a book |
| POST | /return_book | Return a book |
| GET | /issued_books | View all issue records |
| GET | /fines | View all fines |
{ "member_name": "Priya Sharma", "email": "priya@example.com" }{ "member_id": 1, "book_id": 5, "admin_id": 1, "due_date": "2025-05-01" }{ "issue_id": 3 }- Fine = ₹5 per overdue day
- Calculated automatically on book return
- Stored in the
finetable
| Problem | Fix |
|---|---|
| CORS error in browser | Make sure Flask is running and flask-cors is installed |
| DB connection failed | Check connection.py credentials |
| "Admin not found" | Insert a row into admin table first |
| React not loading | Run npm install before npm start |