LibraryManagementSystem
A comprehensive library management application developed using C++ and SQLite, designed to provide an efficient, lightweight solution for managing library collections and inventory. This program can serve as a reference for computer science students working on course assignments.
Install / Use
/learn @Rosweise/LibraryManagementSystemREADME
Overview
libraryManagementSystem is a local, terminal-based library management system built on an SQLite database, which also offers visual management capabilities via a web interface. The system is developed using the C++20 standard, built with CMake, and supports the three major operating systems: Windows, Linux, and macOS.
The system implements role-based access control with two user types:
| Role | Functions | |------|-----------| | Administrator | Book management (CRUD), user management, borrowing record queries | | Student | Book search, borrow/return/renew books, personal account management |
Features
| Feature | Description | |---------|-------------| | Cross-Platform | Native support for Windows, Linux, macOS | | Embedded SQLite | SQLite amalgamation fetched via CMake FetchContent | | Secure Passwords | SHA-256 encrypted password storage | | Security Token | Support for password recovery security tokens | | Overdue Alerts | Automatic detection and notification of overdue books | | Adaptive UI | Tables automatically adjust to terminal width | | Multi-Language Support | Switch between English and Chinese interface languages | | Web Interface | A Modern Vue 3 WebUI | | RESTful API | Node.js Express API server for web integration | | Logging System | Comprehensive logging with query capabilities | | Enhanced Admin Panel | Full book, user, and borrowing management capabilities | | User Management | Complete user registration, authentication, and profile management | | Responsive Design | Optimized for desktop and mobile devices |
Building
Prerequisites
| Dependency | Version | |------------|---------| | CMake | >= 3.11 | | C++ Compiler | C++20 support |
Compiler options by platform:
- Windows: MinGW-w64 or Visual Studio 2019+
- Linux: g++ >= 9.0
- macOS: Apple Clang or gcc
Check CMake installation:
cmake --version
Note: CMake will download the SQLite amalgamation during the configure step.
Method 1: CMake Command Line
Linux / macOS
# Navigate to project directory
cd /path/to/libraryManagementSystem
# Create build directory and compile
cmake -B build && cmake --build build
# Run the program
cd build
./lib
Windows (MinGW-w64)
# Navigate to project directory
cd /d /path/to/libraryManagementSystem
# Create build directory and compile
cmake -B build -G "MinGW Makefiles" && cmake --build build
# Run the program
cd build
lib.exe
Windows (Visual Studio)
# Create Visual Studio solution
cmake -B build -G "Visual Studio 17 2022"
# Build (or open build directory in IDE)
cmake --build build --config Release
# Run the program
build\Release\lib.exe
Method 2: IDE
| IDE | Steps |
|-----|-------|
| CLion | Open project → Auto-detect CMake → Click Run |
| Visual Studio | Open folder → Select lib.exe as startup → Run |
Note: For legacy IDEs like VC++ 6.0, consider using CMake or modern IDEs
Method 3: Cross-Compilation
Compile Windows executables on macOS/Linux:
macOS
# Install dependencies
brew install cmake mingw-w64
# Create build directory
mkdir build && cd build
# Configure cross-compilation
cmake .. -DCMAKE_TOOLCHAIN_FILE=../cmake/Windows-x86.cmake
# Build
cmake --build .
Linux (Ubuntu/Debian)
# Install dependencies
sudo apt-get update
sudo apt-get install -y cmake g++-mingw-w64-x86-64 gcc-mingw-w64-x86-64
# Create build directory
mkdir build && cd build
# Configure cross-compilation
cmake .. -DCMAKE_TOOLCHAIN_FILE=../cmake/Windows-x86.cmake
# Build
cmake --build .
Program Logic
Startup Flow
┌─────────────────────────────────────────────────────────────┐
│ Program Start │
└─────────────────────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────┐
│ Initialize Database (library.db) │
│ - Create table structures │
│ - Check for administrator account │
└─────────────────────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────┐
│ Main Menu │
│ 1. Login 2. Register 3. Forgot Password 0. Exit │
└─────────────────────────────────────────────────────────────┘
User Roles
┌─────────────────────────────────────────────────────────────────────┐
│ User Login │
└─────────────────────────────────────────────────────────────────────┘
│
┌───────────────┴───────────────┐
│ │
▼ ▼
┌──────────────────┐ ┌──────────────────┐
│ Admin (ADMIN) │ │ Student (STUDENT)│
└──────────────────┘ └──────────────────┘
│ │
▼ ▼
┌──────────────────┐ ┌──────────────────┐
│ Admin Menu │ │ Student Menu │
│ 1. Book Mgmt │ │ 1. Search Books │
│ - Add/Edit/ │ │ 2. Borrow Book │
│ Delete/Find │ │ 3. Return Book │
│ 2. User Mgmt │ │ 4. Renew Book │
│ - Add User │ │ 5. My Borrowings │
│ - Change Pass │ │ 6. Account Mgmt │
│ 3. Borrow Mgmt │ │ - View Info │
│ - Query Student│ │ - Edit Info │
│ - All Records │ │ - Change Pass │
└──────────────────┘ │ - Set Token │
└──────────────────┘
Core Functions
1. Book Management (Admin)
| Function | Description | |----------|-------------| | Add Book | Add new book with ISBN, title, author, publisher, category, quantity | | Edit Book | Modify book information by ISBN | | Delete Book | Remove book (requires no active borrowings) | | Search Books | Search by keyword (title/author/ISBN) | | List All Books | Display all books, sortable by title/author/ISBN |
2. Borrowing Management (Student)
| Function | Description | |----------|-------------| | Borrow Book | Enter ISBN and borrowing days (1-90 days) | | Return Book | Return borrowed book by record ID | | Renew Book | Extend borrowing period | | View Borrowings | View personal borrowing records |
3. Account Security
| Function | Description | |----------|-------------| | Change Password | Admin can change any user's password; students can only change their own | | Security Token | Set password recovery token for verification | | Forgot Password | Reset password using username and security token |
4. Overdue Management
- Automatic detection of overdue books
- Students are notified of overdue books upon login
- Admin can view all borrowing records with overdue status
5. Language Switching
- Switch between English and Chinese interface languages
- Language preference is saved in config.ini file
- Accessible from the main menu (option 4)
Screenshots
Main Menu
--- Welcome to Library Management System ---
1. Login
2. Student Registration
3. Forgot Password
4. Choose Language / 选择语言
0. Exit
--------------------------------------------
Please enter your choice:
Language Selection Menu
--- Choose Language ---
1. English
2. 中文
0. Return
-----------------------------
Please enter your choice:
Admin Menu
--- Admin Menu (admin) ---
1. Book Management - Add/Edit/Delete/Search
2. User Management - Add User/Change Password
3. Borrowing Management - Query Student/All Records
0. Logout
-----------------------------
Please enter your choice:
Student Menu
--- Student Menu (Zhang San) ---
1. Search Books
2. Borrow Book
3. Return Book
4. Renew Book
5. View My Borrowings
6. Account Management (View Info/Change Password/Set Token)
0. Logout
---------------------------------
Please enter your choice:
Book List
+----------------------+------------------------+----------------+--------+--------+
| ISBN | Title | Author | Avail | Total |
+----------------------+------------------------+----------------+--------+--------+
| 978-7-111-40701-0 | Computer Systems | Randal E. Bryant| 3 | 5 |
| 978-7-302-33227-9 | C++ Primer Plus | Stephen Prata | 2 | 3 |
+----------------------+------------------------+----------------+--------+--------+
Borrowing Records
+--------+----------------------+----------------------
Related Skills
feishu-drive
347.2k|
things-mac
347.2kManage Things 3 via the `things` CLI on macOS (add/update projects+todos via URL scheme; read/search/list from the local Things database)
clawhub
347.2kUse the ClawHub CLI to search, install, update, and publish agent skills from clawhub.com
codebase-memory-mcp
1.2kHigh-performance code intelligence MCP server. Indexes codebases into a persistent knowledge graph — average repo in milliseconds. 66 languages, sub-ms queries, 99% fewer tokens. Single static binary, zero dependencies.
