Skip to main content

Welcome to SWL Library Management System

SWL is a comprehensive open-source library management platform designed for educational institutions and enterprises that need efficient resource control, equipment loans, and access tracking. Built with Flask and modern web technologies, SWL automates the complete workflow of modern libraries and resource centers, handling everything from user registration to equipment tracking and penalty management.

Who is SWL for?

Educational Institutions

Schools, universities, and training centers managing student equipment loans, library materials, and facility access

Corporate Resource Centers

Companies managing shared equipment, technical resources, and workspace access for employees

Makerspace & Labs

Technical facilities managing specialized equipment like LEGO Education kits, audiovisual gear, and tools

Library Systems

Traditional and modern libraries seeking digital transformation of their operations

Key Capabilities

Multi-Tier User Management

SWL supports four distinct user roles with different permission levels:
  • Admin (SuperUser): Full system control including user management, inventory audits, and system configuration
  • Bibliotecario (Staff): Loan approval, returns processing, and operational management
  • Premium Users: Access to specialized equipment (audiovisual, technical tools) with extended loan privileges
  • Cliente (Regular Users): Standard library access with configurable loan limits

Intelligent Loan Engine

The system provides real-time validation and automated workflows:
  • Real-time stock validation prevents overbooking
  • Duplicate prevention ensures users don’t request the same item twice
  • Automated penalty calculation for overdue items
  • Fast Loan Kiosk Mode for quick self-service without login friction

Dynamic Inventory Management

SWL uses a two-tier inventory system: Catalog items (generic items like “Mouse USB”) and Item Instances (physical units with unique serial codes like “MOU-1-001”).
Features include:
  • Flexible categorization (General vs. Premium/Specialized)
  • Serial number tracking for each physical unit
  • Status management (available, on loan, maintenance, lost)
  • Condition tracking and audit trails

Activity & Access Logging

Track facility usage with:
  • Visit registration and statistics
  • Usage analytics by user type
  • Historical activity reports

Architecture Overview

SWL follows Flask’s modular blueprint pattern for clean separation of concerns:
app/
├── __init__.py           # Application factory & extensions
├── admin/                # Admin dashboard & management
│   ├── __init__.py
│   └── routes.py        # User mgmt, inventory, approvals
├── auth/                 # Authentication system
│   ├── __init__.py
│   └── routes.py        # Login, registration, logout
├── main/                 # User-facing features
│   ├── __init__.py
│   └── routes.py        # Dashboards, kiosk mode
├── services/            # Business logic layer
│   ├── inventory_service.py
│   └── loan_service.py
├── utils/               # Utilities & decorators
│   └── decorators.py   # Role-based access control
├── models.py            # SQLAlchemy models
└── forms.py             # WTForms definitions

Technology Stack

Flask==3.1.3
Flask-SQLAlchemy==3.1.1
Flask-Login==0.6.3
Flask-Migrate==4.1.0
Flask-APScheduler==1.13.1

Database Schema

The system uses five core models:
  1. User: Multi-role user accounts with authentication
  2. Catalog: Generic item definitions (e.g., “VideoBeam”)
  3. ItemInstance: Physical units with unique codes and status
  4. Loan: Complete loan lifecycle tracking
  5. LibraryLog: Facility access and visit records

Key Features at a Glance

SWL uses Flask-APScheduler to run daily tasks:
  • Overdue loan checks run at 00:01 AM daily
  • Automatic penalty calculation based on configurable rates
  • Status updates for late returns
Configure in config.py:
PENALTY_FEE_PER_DAY = 5000.0  # Configurable late fee
SCHEDULER_TIMEZONE = "America/Bogota"
Self-service interface optimized for high-traffic scenarios:
  • No login required - search by document ID
  • Quick item selection and checkout
  • Immediate loan creation
  • Perfect for library entrances and service desks
Granular permissions using custom decorators:
from app.utils.decorators import role_required

@bp.route('/users')
@role_required('admin')
def manage_users():
    # Only admins can access
Production-ready logging with rotation:
  • Rotating file handler (1MB max, 3 backups)
  • Structured log messages with timestamps
  • Configurable log levels
  • Audit trail for all operations

Database Flexibility

SWL automatically uses PostgreSQL in production (via DATABASE_URL environment variable) and falls back to SQLite for development. No code changes needed!
From config.py:
SQLALCHEMY_DATABASE_URI = os.environ.get('DATABASE_URL') or \
    'sqlite:///' + os.path.join(basedir, 'instance', 'app.db')

Security Features

  • Password hashing with Werkzeug’s PBKDF2
  • Session management with configurable timeouts (30 minutes default)
  • CSRF protection via Flask-WTF
  • Secret key configuration for production deployments
  • Role-based access control on all sensitive endpoints

Next Steps

Quick Start

Get SWL running in 5 minutes

Installation Guide

Detailed setup instructions

Configuration

Environment and deployment config

API Reference

Explore the codebase
SWL is designed for self-hosting. You maintain full control of your data and can customize the system to your institution’s specific needs.

Build docs developers (and LLMs) love