Skip to content

iamroidev/Library-Management-System

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Library Management System

Flask web application for library operations — book catalog, member management, loans, role-based access, admin dashboards, backups, and reporting — backed by Microsoft SQL Server.


Table of Contents


System Design

A server-rendered Flask monolith with blueprint-based auth and raw SQL via pyodbc. Role decorators gate access to Admin, Staff, Member, and Guest dashboards. Database bootstrap runs on startup to seed default roles and an admin account.

flowchart TB
  Browser[Browser]
  Flask[Flask App]
  Auth[auth.py Blueprint]
  SQL[(SQL Server)]
  Templates[Jinja2 Templates]

  Browser --> Flask
  Flask --> Auth
  Flask --> Templates
  Flask --> SQL
Loading
Layer Role
app.py Core routes, CRUD, reports, backup/restore
auth.py Login, register, role decorators
models.py Data classes (no ORM)
database/ Setup scripts, sample data, triggers/procedures

Features

  • Role-based dashboards: Admin, Staff, Member, Guest
  • Book catalog CRUD, issue/return workflows
  • Member management and loan history API
  • User/role admin: add, edit, reset password, toggle status
  • Activity logs, statistics, and report generation
  • Database backup, restore, and download (admin)
  • Auto-creates default roles, admin user, and categories on startup

Technology Stack

Component Technology
Backend Python 3, Flask 2.2
Database Microsoft SQL Server via pyodbc
Auth driver ODBC Driver 17 for SQL Server
Templates Jinja2
Data access Raw SQL (no ORM)

Getting Started

Prerequisites

  • Python 3.8+
  • Microsoft SQL Server
  • ODBC Driver 17 for SQL Server
  • pyodbc (pip install pyodbc — not listed in requirements.txt)

Setup

pip install -r requirements.txt
pip install pyodbc

# 1. Create database — run in SQL Server:
#    database/setup_database.sql

# 2. Optional bootstrap:
python init_db.py

# 3. Start server:
python app.py
# → http://localhost:5000 (debug mode)

Configuration

Variable Default Purpose
SECRET_KEY mysecretlibrarysystem Flask session secret
DB_DRIVER ODBC Driver 17 for SQL Server ODBC driver name

Connection uses Windows Trusted Connection (Trusted_Connection=yes). Update config.py with your SQL Server host and database name for your environment.


Deployment

Designed for on-premises Windows + SQL Server:

  1. Install SQL Server and ODBC Driver 17
  2. Run database/setup_database.sql
  3. Configure config.py for your server
  4. Run behind IIS or a WSGI server for production

No Docker configuration included.


Project Structure

Library-Management-System/
├── app.py
├── auth.py
├── config.py
├── models.py
├── init_db.py
├── database/
│   ├── setup_database.sql
│   ├── sample_data.sql
│   └── triggers_functions_procedures.sql
├── templates/
└── static/css|js/

License

See repository for license terms.

About

Database management system for cataloging library books, users, and borrowing transactions.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors