This is the backend repository for the Library Management System, a web-based application for managing library resources, users, and transactions. The backend is built using Flask, a lightweight Python web framework, and provides a RESTful API for the frontend to interact with.
This project is an assignment for the course "Database Course Design". The front-end project address: https://github.com/larryyan/library-management-system-frontend"
- User authentication and authorization
- Book management (add, update, delete, search)
- User management (add, update, delete, search)
- Borrowing and returning books
- Overdue book tracking
- Reporting and statistics
- Python
- Flask
- Flask-SQLAlchemy
- Flask-JWT-Extended
- SQLite
- Python 3.11 or higher
- pip (Python package installer)
-
Clone the repository:
git clone https://github.com/larryyan/library-management-system-backend.git
-
Navigate to the project directory:
cd library-management-system-backend
-
Create a virtual environment:
python3 -m venv venv
-
Activate the virtual environment:
source venv/bin/activate
-
Install the required dependencies:
pip install -r requirements.txt
-
Set up the database:
flask create
-
Start the development server:
python app.py
The backend server will be running at
http://localhost:5000
.
The following are the main API endpoints provided by the backend:
POST /login
: User loginPOST /logout
: User logoutGET /books/<id>
: Get a specific book by IDPOST /books
: Add a new bookPUT /books/<id>
: Update a bookDELETE /books/<id>
: Delete a bookGET /book_info
: Get detailed information about all booksGET /book_info/<id>
: Get detailed information about a bookGET /reader/<id>
: Get a specific user by IDPOST /reader
: Add a new userPUT /reader/<id>
: Update a userDELETE /reader/<id>
: Delete a userPOST /borrow/<book_id>/<reader_id>
: Borrow a bookPOST /return/<book_id>/<reader_id>
: Return a book
For detailed information about request and response formats, please refer to the API documentation.
The backend uses SQLite as the database. The main tables in the database schema are:
reader
: Stores user informationbook
: Stores book informationborrow
: Stores borrowing transactionsbook_info
: Stores detailed information about books
For more details about the database schema, please refer to the database migration files in the migrations
directory.
This project is licensed under the MIT License. See the LICENSE
file for more information.