Skip to content

jigisha24/LibraryManagementSystem

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

📖 Library Management System — Full Stack

A full-stack web application built with Python Flask (backend) and React (frontend), connected to a MySQL database.


📁 Project Structure

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)

⚙️ Step 1 — Configure Database

  1. Open backend/db/connection.py
  2. 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

🐍 Step 2 — Run Backend (Flask)

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


⚛️ Step 3 — Run Frontend (React)

cd library-app/frontend

# Install dependencies
npm install

# Start React development server
npm start

✅ Frontend runs at: http://localhost:3000


🔌 API Endpoints

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

📋 POST Request Body Formats

POST /add_member

{ "member_name": "Priya Sharma", "email": "priya@example.com" }

POST /issue_book

{ "member_id": 1, "book_id": 5, "admin_id": 1, "due_date": "2025-05-01" }

POST /return_book

{ "issue_id": 3 }

💰 Fine Calculation

  • Fine = ₹5 per overdue day
  • Calculated automatically on book return
  • Stored in the fine table

🛠️ Troubleshooting

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

About

Library Management system using python

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors