A feature-rich, terminal-based Digital Library Management System built with Python and MySQL. It supports dual-role access (Admin & User), full book and user CRUD operations, book issuing/returning with fine calculation, personal note-taking, live news fetching, and Wikipedia article lookup β all from an interactive command-line interface.
- Features
- Tech Stack
- Project Structure
- Database Schema
- Prerequisites
- Installation
- Configuration
- Running the Application
- Application Flow
- Return Policy & Fine Calculation
- External APIs
- Screenshots
- Separate login flows for Admin and User roles
- Password-based authentication with session tracking
- Admin can switch to User panel and vice versa
- Add a new book (Book ID, Name, Publication Year, Author)
- Delete an existing book
- Update book details (ID, Name, Publication Year, Author)
- Display all books with full details
- Search books by Book ID or keyword
- Add a new library member (User ID, Name, Phone, Email, Password)
- Delete an existing user
- Update user details (ID, Name, Phone Number, Email, Password)
- Display all enrolled users
- Search users by User ID or keyword
- Issue a book to a specific user (records issue date & time)
- Return a book and automatically track return date & time
- Fine calculation for overdue returns (βΉ5/day after 14-day grace period)
- Full history maintained in
issuedBooksDetailstable
- Add a personal note (Note Number, Title, Description)
- Delete a note
- Update a note (Number, Title, Description)
- Display all notes with timestamps
- Search notes by Note Number or keyword
- Fetches top headlines via the NewsAPI
- Filter by country code and category (business, entertainment, general, health, science, sports, technology)
- Configurable number of articles
- Search any topic and retrieve a Wikipedia article summary
- Configurable article summary length
- Displays article title, full URL, and formatted summary
- View library establishment year, librarian name, total books, and total users
- The current admin can transfer admin privileges to any other registered user (with password verification)
| Component | Technology |
|---|---|
| Language | Python 3.x |
| Database | MySQL |
| DB Connector | mysql-connector-python |
| ASCII Art Banner | pyfiglet |
| News API Client | requests |
| Wikipedia Client | wikipedia-api |
| Interface | CLI (Terminal) |
Digital Library/
β
βββ main.py # Main application entry point (all logic)
βββ NEWS_API_KEY.txt # NewsAPI key reference file
βββ README.md # Project documentation
β
βββ project files/
β βββ Digital Library.pdf # Project report / documentation
β βββ editable files/ # Source/editable project assets
β
βββ application screenshots/ # Screenshots of the running application
βββ database screenshots/ # Screenshots of the MySQL database
βββ errors & exceptions screenshots/ # Screenshots of error handling
The application uses a MySQL database named library with the following tables:
| Column | Type | Description |
|---|---|---|
bookId |
INT (PK) | Unique book identifier |
bookName |
VARCHAR | Title of the book |
publicationYear |
INT | Year the book was published |
author |
VARCHAR | Author's name |
issueStatus |
VARCHAR | 'issued' or 'not issued' |
issueDate |
DATE | Date the book was issued |
issueTime |
TIME | Time the book was issued |
returnDate |
DATE | Date the book was returned |
returnTime |
TIME | Time the book was returned |
issuedUserId |
INT (FK) | User ID to whom the book is issued |
| Column | Type | Description |
|---|---|---|
userId |
INT (PK) | Unique user identifier |
userName |
VARCHAR | Full name of the user |
phoneNumber |
VARCHAR | User's phone number |
emailId |
VARCHAR | User's email address |
password |
VARCHAR | User's login password |
adminStatus |
VARCHAR | 'admin' or 'not admin' |
| Column | Type | Description |
|---|---|---|
userId |
INT (FK) | Owner of the note |
noteNumber |
INT | User-defined note number |
noteTitle |
VARCHAR | Title of the note |
noteDescription |
TEXT | Body/content of the note |
updateDate |
DATE | Last updated date |
updateTime |
TIME | Last updated time |
| Column | Type | Description |
|---|---|---|
userId |
INT (FK) | User who issued the book |
bookId |
INT (FK) | ID of the issued book |
bookName |
VARCHAR | Name of the issued book |
issueDate |
DATE | Date the book was issued |
issueTime |
TIME | Time the book was issued |
returnDate |
DATE | Date the book was returned |
returnTime |
TIME | Time the book was returned |
fineInRs |
INT | Fine charged in Indian Rupees (βΉ) |
Make sure the following are installed on your system:
- Python 3.7+ β Download Python
- MySQL Server β Download MySQL
- pip (Python package manager)
-
Clone or download the repository:
git clone <repository-url> cd "Digital Library"
-
Install the required Python packages:
pip install mysql-connector-python pyfiglet requests wikipedia-api
-
Set up the MySQL database:
- Open your MySQL client (MySQL Workbench, CLI, etc.)
- Create the database and tables:
CREATE DATABASE library; USE library; CREATE TABLE books ( bookId INT PRIMARY KEY, bookName VARCHAR(255), publicationYear INT, genre VARCHAR(100), language VARCHAR(50), edition VARCHAR(50), copies INT, author VARCHAR(255), issueStatus VARCHAR(20) DEFAULT 'not issued', issueDate DATE, issueTime TIME, returnDate DATE, returnTime TIME, issuedUserId INT ); CREATE TABLE users ( userId INT PRIMARY KEY, userName VARCHAR(255), phoneNumber VARCHAR(20), emailId VARCHAR(255), password VARCHAR(255), adminStatus VARCHAR(20) DEFAULT 'not admin' ); CREATE TABLE notes ( userId INT, noteNumber INT, noteTitle VARCHAR(255), noteDescription TEXT, updateDate DATE, updateTime TIME ); CREATE TABLE issuedBooksDetails ( userId INT, bookId INT, bookName VARCHAR(255), issueDate DATE, issueTime TIME, returnDate DATE, returnTime TIME, fineInRs INT DEFAULT 0 );
- Insert the first admin user:
INSERT INTO users (userId, userName, phoneNumber, emailId, password, adminStatus) VALUES (1, 'YourName', '9999999999', 'admin@example.com', 'yourpassword', 'admin');
Open main.py and update the database connection credentials at the top of the file:
db = mysql.connector.connect(
host="localhost",
user="YOUR_MYSQL_USERNAME", # e.g., "root"
password="YOUR_MYSQL_PASSWORD", # e.g., "password123"
database="library",
)Note: The NewsAPI key is already embedded in the
news()function. To use your own key, replace the value ofAPI_KEYin thenews()function with your key from newsapi.org.
python main.pyThe application will launch with an ASCII art welcome banner and present the Home Menu.
Home
βββ 1. Admin (requires authentication)
β βββ Login into User Panel
β βββ Modify User
β β βββ Add User
β β βββ Delete User
β β βββ Update User Details
β βββ Display Users
β βββ Search Users (by ID / keyword)
β βββ Modify Book
β β βββ Add Book
β β βββ Delete Book
β β βββ Update Book Details
β βββ Issue Book
β βββ Return Book
β βββ Change Admin
β
βββ 2. User (requires authentication)
β βββ About Library
β βββ News
β βββ Wikipedia Articles
β βββ Display Books
β βββ Search Books (by ID / keyword)
β βββ Issued Books Details
β βββ Notes
β βββ Modify Note (Add / Delete / Update)
β βββ Display Notes
β βββ Search Notes (by Number / keyword)
β
βββ 3. Exit
- Books must be returned within 14 days (2 weeks) of issue.
- For every extra day beyond the 14-day period, a fine of βΉ5 per day is charged.
- The fine is automatically calculated and recorded in the
issuedBooksDetailstable upon return.
Example: If a book is kept for 20 days, the extra days = 20 - 14 = 6 days, and the fine = 6 Γ βΉ5 = βΉ30.
| API | Provider | Purpose | Documentation |
|---|---|---|---|
| NewsAPI | newsapi.org | Fetch top news headlines | newsapi.org/docs |
| Wikipedia | wikipedia-api | Fetch Wikipedia article summaries | PyPI: wikipedia-api |
Screenshots of the application in action are available in the following directories:
application screenshots/β Shows various menus and features of the running applicationdatabase screenshots/β Shows the MySQL database tables and recordserrors & exceptions screenshots/β Shows how the application handles invalid inputs and errors
This project is for educational purposes. Feel free to use and modify it for learning and personal projects.
Built with β€οΈ using Python & MySQL