A full-stack web application designed to streamline library operations and enhance the reading experience. Built as a college project, this system demonstrates practical implementation of web development concepts while solving real-world library management challenges.
This Library Management System is a server-side rendered web application developed using Flask, offering a complete solution for managing library resources, user interactions, and administrative tasks. The application follows the traditional Model-View-Controller (MVC) architecture, where all pages are dynamically rendered on the server using Jinja2 templates, providing a seamless and interactive experience.
Developed as part of academic coursework, this project showcases the integration of modern web technologies, database management, and user-centric design principles to create a practical library management solution.
Libraries are fundamental to education and knowledge sharing, yet managing them efficiently can be challenging. This application was created to:
- Simplify book cataloging and organization for librarians
- Provide readers with easy access to library resources
- Automate routine tasks like request handling and access expiration
- Offer insights through analytics and statistics
- Demonstrate full-stack development capabilities in an academic setting
- User Registration & Login: Secure signup and login system for readers
- Librarian Authentication: Separate login portal for librarians with role-based access
- Password Security: Bcrypt hashing for secure password storage
- Profile Management: Upload profile pictures, view account information, and delete accounts
- Session Management: Secure session handling with Flask-Login
- CRUD Operations: Create, read, update, and delete books with metadata (name, author, description, cover images, PDF attachments)
- Book Organization: Assign/remove books from sections and view by section
- Book Tracking: Issue count tracking and date management
- CRUD Operations: Create, edit, and delete sections with descriptions and custom images
- Section Features: View all sections with book counts and add multiple books to sections in bulk
- Request Management: Users can request books for various durations (6 hours to 2 weeks), view pending requests, and cancel requests
- Access Control: Librarians review and approve/reject requests with configurable access durations
- Automatic Expiration: Scheduled task runs every 5 seconds to automatically expire and remove outdated book access
- Fair Resource Distribution: Maximum limit of 5 concurrent book access grants per user
- Rating System: 5-star ratings with average calculations and top-rated showcases
- Comment System: Users and librarians can leave timestamped comments on books
- Advanced Search: Filter by book name, author, description, and section with real-time filtering
- Recommendations: Top-rated books showcase and book popularity tracking
- Dashboard Analytics: Track total books, sections, readers, requests, and active access
- Visual Charts: Interactive pie charts for book distribution and bar charts for top-rated books
- User Statistics: Personal reading history, completed books, and currently accessed books with remaining time
- In-Browser Viewer: Full-screen PDF access with text-to-speech functionality and access control
- Role-Based Access Control (RBAC): Librarian-only and user-only routes with automatic role verification
- Error Handling: Custom error pages (403, 404, 500) with user-friendly messages
- Data Validation: Input sanitization, secure file uploads, SQL injection prevention, and XSS protection
- Flask: Web framework
- SQLAlchemy: ORM for database operations
- Flask-Migrate: Database migrations
- Flask-Login: User session management
- Flask-Bcrypt: Password hashing
- Flask-RESTful: REST API development
- Flask-CORS: Cross-origin resource sharing
- Flask-APScheduler: Task scheduling for automatic access expiration
- Alembic: Database migration tool
- Bootstrap 5: Responsive CSS framework
- JavaScript (ES6+): Client-side interactivity
- Chart.js: Data visualization (bar charts)
- Google Charts: Data visualization (pie charts)
- Font Awesome: Icons
- Jinja2: Template engine
- SQLite3: Lightweight relational database
- Werkzeug: WSGI utilities and file handling
- python-dateutil: Date/time utilities
- pytz: Timezone support
Library-Management-Application/
β
βββ application/ # Main application package
β βββ __init__.py
β βββ api.py # RESTful API endpoints
β βββ config.py # Configuration settings
β βββ controllers.py # Route handlers and business logic
β βββ database.py # Database initialization
β βββ functions.py # Helper functions and utilities
β βββ login.py # Authentication and authorization
β βββ models.py # SQLAlchemy database models
β
βββ database/ # Database files
β βββ database.sqlite3 # SQLite database
β
βββ media/ # Media storage
β βββ pdfs/ # PDF files
β βββ picture/ # Image files
β βββ books/ # Book cover images
β βββ profiles/ # User profile pictures
β βββ sections/ # Section images
β βββ ... # Other images
β
βββ migrations/ # Database migrations
β βββ alembic.ini
β βββ env.py
β βββ versions/ # Migration scripts
β
βββ static/ # Static files
β βββ script.js # JavaScript files
β βββ style.css # CSS styles
β
βββ templates/ # Jinja2 templates
β βββ base.html # Base template
β βββ index.html # Landing page
β βββ user_home.html # User dashboard
β βββ librarian_home.html # Librarian dashboard
β βββ dashboard.html # Dynamic dashboard
β βββ book.html # Book card component
β βββ sections.html # Section card component
β βββ profile.html # User profile page
β βββ search.html # Search results
β βββ add_book.html # Add book form
β βββ add_section.html # Add section form
β βββ signup.html # Registration page
β βββ user_login.html # User login
β βββ librarian_login.html # Librarian login
β βββ 403.html # Forbidden error page
β βββ 404.html # Not found error page
β βββ 500.html # Server error page
β
βββ app.py # Application entry point
βββ requirements.txt # Python dependencies
βββ .gitignore # Git ignore rules
βββ README.md # Project documentation
- Python 3.8 or higher
- pip (Python package manager)
- Git (optional, for cloning)
git clone <repository-url>
cd Library-Management-Application# Windows
python -m venv .venv
.venv\Scripts\activate
# Linux / Mac
python3 -m venv .venv
source .venv/bin/activatepip install -r requirements.txtSkip this step if you already have an existing database configured.
The database is automatically created on first run. If you want to set up a fresh database or manage migrations manually, run:
# Initialize migration repository (if not already done)
flask db init
# Create initial migration
flask db migrate -m "Initial migration"
# Apply migrations
flask db upgradeRequired only for first-time setup with a new database.
On the first run, the application will prompt you in the terminal to create a librarian account:
- Enter a librarian username
- Enter a password (input hidden)
If youβre using an existing database, this step is not required.
python app.pyThe application will be available at:
π http://localhost:5000
- Login with your credentials β Access the admin dashboard
- Create sections to organize your library (Fiction, Science, etc.)
- Add books with details, cover images, and PDF files
- Review pending requests β Approve/reject with access duration
- Monitor analytics and manage user accounts
- Sign up and create your account
- Browse books by section or search by title/author
- Request books with your preferred reading duration
- Once approved, read PDFs directly in your browser
- Rate and comment on books you've read
- Password Protection: Bcrypt hashing for secure credential storage
- Role-Based Access Control: Separate interfaces and permissions for librarians and readers
- Session Management: Secure user sessions with Flask-Login
- Input Validation: Protection against SQL injection and XSS attacks
- File Upload Security: Validated and sanitized file uploads
- Error Handling: Graceful error pages that don't expose sensitive information
This project was developed as part of college coursework to demonstrate:
- Full-stack web development proficiency
- Database design and management
- User authentication and authorization
- Server-side rendering with Flask and Jinja2
- RESTful API development
- Responsive web design principles
- Practical application of software engineering concepts
The project emphasizes clean code, proper documentation, and real-world applicability while maintaining academic rigor.
Unlike modern single-page applications (SPAs), this project utilizes traditional server-side rendering where:
- Pages are fully rendered on the server using Jinja2 templates
- HTML is sent to the client as complete documents
- Reduces client-side JavaScript complexity
- Provides better initial load times and SEO benefits
- Demonstrates fundamental web development principles
Built with dedication as a learning journey in web development πβ¨
Questions or feedback? Feel free to reach out!