Complete README Template
# Library Management System
## ๐ About The Project
The Library Management System is a comprehensive web application built with Laravel 10 that helps libraries manage their book inventory, borrowings, and user accounts efficiently.
### Key Features
- ๐ User Authentication (Login, Register, Logout)
- ๐ Book Management (CRUD operations)
- ๐ Borrowing System with due date tracking
- ๐ง Email Notifications for borrowed books and reminders
- ๐ Advanced Search and Filtering
- ๐ Dashboard with Statistics
- ๐ฅ Role-based Access Control (Admin/User)
- ๐ฑ Responsive Design (Mobile & Desktop)
### Built With
- [Laravel 10](https://laravel.com/)
- [Bootstrap 5](https://getbootstrap.com/)
- [MySQL 8.0](https://www.mysql.com/)
- [Laravel Breeze](https://github.com/laravel/breeze) - Authentication
- [Laravel Mail](https://laravel.com/docs/mail) - Email Notifications
## ๐ Getting Started
### Prerequisites
Before you begin, ensure you have the following installed:
- PHP >= 8.1
- Composer
- MySQL >= 8.0
- Node.js & NPM
- Git
### Installation
1. **Clone the repository**
```bash
git clone https://github.com/yourusername/library-system.git
cd library-system
```
2. **Install PHP dependencies**
```bash
composer install
```
3. **Install NPM dependencies**
```bash
npm install
npm run dev
```
4. **Create environment file**
```bash
cp .env.example .env
```
5. **Generate application key**
```bash
php artisan key:generate
```
6. **Configure database**
Create a MySQL database and update `.env`:
```
DB_DATABASE=library_system
DB_USERNAME=root
DB_PASSWORD=your_password
```
7. **Run migrations and seeders**
```bash
php artisan migrate --seed
```
8. **Create storage link**
```bash
php artisan storage:link
```
9. **Start development server**
```bash
php artisan serve
```
10. **Visit the application**
Open your browser and navigate to: `http://localhost:8000`
### Default Login Credentials
- **Admin:**
- Email: admin@library.com
- Password: password
- **User:**
- Email: user@library.com
- Password: password
## ๐ฑ Usage
### For Students
1. **Register Account:** Click "Register" and fill in your details
2. **Browse Books:** View available books in the catalog
3. **Search Books:** Use search bar to find specific titles or authors
4. **View Borrowing History:** Check your borrowed books and due dates
### For Librarians
1. **Manage Books:** Add, edit, or delete books from the catalog
2. **Process Borrowings:** Issue books to students
3. **Handle Returns:** Process book returns and calculate fines if overdue
4. **View Reports:** Access borrowing statistics and popular books
### For Administrators
1. **Manage Users:** Create and manage user accounts
2. **Manage Categories:** Add and organize book categories
3. **View Dashboard:** Monitor system statistics
4. **Generate Reports:** Access comprehensive borrowing reports
## ๐๏ธ Database Schema
### Tables
- **users** - Store user accounts and authentication
- **categories** - Book categories (Fiction, Science, etc.)
- **books** - Book information and inventory
- **borrowings** - Track book borrowing records
- **fines** - Store overdue fines
### Relationships
- One User โ Many Borrowings
- One Book โ Many Borrowings
- One Category โ Many Books
- One Borrowing โ One Fine (optional)
## ๐ง Email Configuration
Update `.env` with your SMTP settings:
```
MAIL_MAILER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=your-email@gmail.com
MAIL_PASSWORD=your-app-password
MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS=your-email@gmail.com
MAIL_FROM_NAME="Library System"
```
## ๐งช Running Tests
```bash
# Run all tests
php artisan test
# Run specific test file
php artisan test tests/Feature/BookTest.php
# Run with coverage
php artisan test --coverage
```
## ๐ Project Structure
```
library-system/
โโโ app/
โ โโโ Http/Controllers/ # Application controllers
โ โโโ Models/ # Eloquent models
โ โโโ Notifications/ # Email notifications
โโโ database/
โ โโโ migrations/ # Database migrations
โ โโโ seeders/ # Database seeders
โโโ resources/
โ โโโ views/ # Blade templates
โโโ routes/
โ โโโ web.php # Web routes
โ โโโ api.php # API routes
โโโ public/
โโโ storage/ # Uploaded files
```
## ๐ค Contributing
Contributions are welcome! Please follow these steps:
1. Fork the Project
2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)
3. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)
4. Push to the Branch (`git push origin feature/AmazingFeature`)
5. Open a Pull Request
## ๐ License
This project is licensed under the MIT License.
## ๐ฅ Team Members
- **Ahmad Ibrahim** - Team Lead / Backend Developer
- **Fatima Yusuf** - Frontend Developer
- **Musa Abdullahi** - Database Designer / Tester
## ๐ Acknowledgments
- Laravel Framework
- Bootstrap
- Our instructor: Ahmad Tijjani Garba
- Next-Step Technology
## ๐ Contact
Project Link: [https://github.com/yourusername/library-system](https://github.com/yourusername/library-system)
---
Made with โค๏ธ by Team BookKeepers
USER_MANUAL.md Template
# Library Management System - User Manual
## Table of Contents
1. [Getting Started](#getting-started)
2. [Student Guide](#student-guide)
3. [Librarian Guide](#librarian-guide)
4. [Administrator Guide](#administrator-guide)
5. [Troubleshooting](#troubleshooting)
## Getting Started
### Creating an Account
1. Navigate to the registration page
2. Fill in the following information:
- Full Name
- Email Address
- Password (minimum 8 characters)
- Confirm Password
3. Click "Register"
4. Check your email for verification (if enabled)
5. Login with your credentials
### Logging In
1. Click "Login" on the homepage
2. Enter your email and password
3. Click "Login"
4. You will be redirected to your dashboard
## Student Guide
### Browsing Books
1. Click "Books" in the navigation menu
2. Browse through the book catalog
3. Use filters to narrow down results:
- Search by title, author, or ISBN
- Filter by category
- Filter by availability
### Viewing Book Details
1. Click on any book card
2. View detailed information:
- Title, Author, ISBN
- Description
- Category
- Availability status
- Publication year
### Checking Borrowing History
1. Go to "My Borrowings"
2. View your current and past borrowings
3. Check due dates
4. View any pending fines
## Librarian Guide
### Adding a New Book
1. Go to "Books" โ "Add Book"
2. Fill in the book details:
- Title (required)
- Author (required)
- ISBN (required, must be unique)
- Category (required)
- Description (optional)
- Quantity (required)
- Publication Year (optional)
- Cover Image (optional, max 2MB)
3. Click "Add Book"
4. Book will appear in the catalog
### Processing a Book Borrowing
1. Go to "Borrowings" โ "New Borrowing"
2. Select the student
3. Select the book
4. Add any notes (optional)
5. Click "Issue Book"
6. System will:
- Create borrowing record
- Decrease available quantity
- Send email to student with due date
### Processing a Book Return
1. Go to "Borrowings"
2. Find the borrowing record
3. Click "Return Book"
4. System will:
- Mark as returned
- Increase available quantity
- Calculate fine if overdue
- Create fine record if applicable
### Viewing Reports
1. Go to Dashboard
2. View statistics:
- Total books
- Available books
- Active borrowings
- Overdue books
3. View recent activity
4. View popular books list
## Administrator Guide
### Managing Categories
1. Go to "Categories"
2. To add a new category:
- Click "Add Category"
- Enter name and description
- Click "Save"
3. To edit a category:
- Click "Edit" on category
- Update information
- Click "Update"
4. To delete a category:
- Click "Delete"
- Confirm deletion
### Managing Users
1. Go to "Users" (admin only)
2. View all registered users
3. Edit user roles:
- Student
- Librarian
- Administrator
4. Deactivate users if needed
## Troubleshooting
### Cannot Login
**Problem:** Email or password incorrect
**Solution:**
- Check that CAPS LOCK is off
- Verify your email address is correct
- Use "Forgot Password" to reset
### Book Not Showing in Search
**Problem:** Cannot find a specific book
**Solution:**
- Check spelling of search term
- Try searching by author instead of title
- Remove category filter
- Check if book is actually in the system
### Cannot Borrow Book
**Problem:** Error message when trying to borrow
**Solution:**
- Check if book is available (quantity > 0)
- Check if you have overdue books or fines
- Contact librarian for assistance
### Email Notifications Not Received
**Problem:** Not getting email notifications
**Solution:**
- Check spam/junk folder
- Verify email address in your profile
- Contact administrator to check email settings
## Keyboard Shortcuts
- **Ctrl + K** - Quick search
- **Ctrl + H** - Go to home/dashboard
- **Ctrl + B** - Go to books page
- **Esc** - Close modal dialogs
## Contact Support
If you encounter any issues not covered in this manual:
- Email: support@library.com
- Phone: +234-XXX-XXX-XXXX
- Visit the library desk during office hours
TECHNICAL_DOCS.md
# Technical Documentation
## Architecture Overview
The Library Management System follows the MVC (Model-View-Controller) architecture pattern provided by Laravel.
### Technology Stack
- **Backend:** Laravel 10.x (PHP 8.1+)
- **Frontend:** Blade Templates, Bootstrap 5.3, JavaScript
- **Database:** MySQL 8.0
- **Authentication:** Laravel Breeze
- **Email:** Laravel Mail (SMTP)
- **File Storage:** Laravel Storage (local/public disk)
## Database Schema
### Users Table
```sql
CREATE TABLE users (
id BIGINT UNSIGNED PRIMARY KEY AUTO_INCREMENT,
name VARCHAR(255) NOT NULL,
email VARCHAR(255) UNIQUE NOT NULL,
password VARCHAR(255) NOT NULL,
is_admin BOOLEAN DEFAULT 0,
created_at TIMESTAMP,
updated_at TIMESTAMP
);
```
### Categories Table
```sql
CREATE TABLE categories (
id BIGINT UNSIGNED PRIMARY KEY AUTO_INCREMENT,
name VARCHAR(255) NOT NULL,
description TEXT,
created_at TIMESTAMP,
updated_at TIMESTAMP
);
```
### Books Table
```sql
CREATE TABLE books (
id BIGINT UNSIGNED PRIMARY KEY AUTO_INCREMENT,
title VARCHAR(255) NOT NULL,
author VARCHAR(255) NOT NULL,
isbn VARCHAR(255) UNIQUE NOT NULL,
category_id BIGINT UNSIGNED,
description TEXT,
quantity INT DEFAULT 1,
available_quantity INT DEFAULT 1,
cover_image VARCHAR(255),
publication_year YEAR,
created_at TIMESTAMP,
updated_at TIMESTAMP,
FOREIGN KEY (category_id) REFERENCES categories(id) ON DELETE CASCADE
);
```
### Borrowings Table
```sql
CREATE TABLE borrowings (
id BIGINT UNSIGNED PRIMARY KEY AUTO_INCREMENT,
user_id BIGINT UNSIGNED,
book_id BIGINT UNSIGNED,
borrowed_date DATE NOT NULL,
due_date DATE NOT NULL,
return_date DATE,
status ENUM('borrowed', 'returned', 'overdue') DEFAULT 'borrowed',
notes TEXT,
created_at TIMESTAMP,
updated_at TIMESTAMP,
FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE,
FOREIGN KEY (book_id) REFERENCES books(id) ON DELETE CASCADE
);
```
## API Endpoints
### Authentication
- POST /register - Register new user
- POST /login - User login
- POST /logout - User logout
### Books
- GET /books - List all books (paginated)
- GET /books/{id} - Get single book
- POST /books - Create new book (admin only)
- PUT /books/{id} - Update book (admin only)
- DELETE /books/{id} - Delete book (admin only)
### Borrowings
- GET /borrowings - List borrowings
- POST /borrowings - Create new borrowing
- POST /borrowings/{id}/return - Return a book
## Environment Variables
Required `.env` variables:
```
APP_NAME="Library Management System"
APP_ENV=production
APP_DEBUG=false
APP_URL=https://your-domain.com
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=library_db
DB_USERNAME=db_user
DB_PASSWORD=secure_password
MAIL_MAILER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=your-email@gmail.com
MAIL_PASSWORD=app-password
MAIL_ENCRYPTION=tls
```
## Deployment Checklist
- [ ] Set `APP_ENV=production`
- [ ] Set `APP_DEBUG=false`
- [ ] Generate new `APP_KEY`
- [ ] Configure production database
- [ ] Configure mail settings
- [ ] Run migrations
- [ ] Run `php artisan optimize`
- [ ] Run `php artisan config:cache`
- [ ] Run `php artisan route:cache`
- [ ] Run `php artisan view:cache`
- [ ] Set proper file permissions
- [ ] Configure backup schedule
- [ ] Set up SSL certificate
## Performance Optimization
1. **Query Optimization**
- Use eager loading for relationships
- Add database indexes on frequently queried columns
- Use pagination for large datasets
2. **Caching**
- Cache categories and static data
- Use Redis for session storage (production)
- Cache configuration and routes
3. **Asset Optimization**
- Minify CSS and JavaScript
- Optimize and compress images
- Use CDN for static assets
## Security Best Practices
- All passwords are hashed using bcrypt
- CSRF protection enabled on all forms
- SQL injection prevention via Eloquent ORM
- XSS protection via Blade escaping
- Authentication middleware on protected routes
- File upload validation and sanitization