Skip to content

Repository files navigation

Library Management System

Python desktop application for managing library books with a Tkinter interface and Supabase backend.

Overview

This project provides a simple library system with separate user and admin access. It supports authentication, book management, searching, borrowing, and returning books through a desktop UI.

Features

  • User and admin login
  • User and admin registration
  • Role-based navigation after login
  • View and search books
  • Add books
  • Delete books
  • Borrow books
  • Return books
  • Windows .exe packaging with custom app icon

Tech Stack

  • Python
  • Tkinter
  • Supabase REST API
  • PyInstaller

Project Structure

LibraryManagementSystem-main/
|-- LibraryManagementSystem/
|   |-- LoginRegisterSystem.py
|   |-- adminview.py
|   |-- userview.py
|   |-- BB.py
|   |-- RB.py
|   |-- borrowBook.py
|   |-- returnBook.py
|   |-- supabase_db.py
|   |-- authentication.py
|   `-- database.sql
|-- asset/
|   |-- book.png
|   `-- book.ico
|-- requirements.txt
`-- README.md

Screens and Flow

  • Login as User opens the user panel
  • Login as Admin opens the admin panel
  • Logout returns to the login screen
  • Borrow and return actions open separate desktop windows inside the same application process

Requirements

  • Windows
  • Python 3.12 or newer
  • A Supabase project

Installation

Install project dependencies:

py -m pip install -r requirements.txt

Install the executable builder:

py -m pip install pyinstaller

Supabase Setup

Set your Supabase credentials before running the app:

$env:SUPABASE_URL="https://your-project.supabase.co"
$env:SUPABASE_KEY="your-supabase-key"

The app can also fall back to values defined in supabase_db.py, but environment variables are the better approach.

Database Setup

Run the SQL in database.sql inside Supabase SQL Editor.

Required tables:

  • books
  • users
  • admins

Schema:

create table if not exists books (
    id bigint generated by default as identity primary key,
    book_id text unique not null,
    title text not null,
    author text not null,
    isbn text not null,
    quantity integer not null default 0,
    borrowed_time timestamptz,
    return_time timestamptz
);

create table if not exists users (
    id bigint generated by default as identity primary key,
    username text unique not null,
    password text not null
);

create table if not exists admins (
    id bigint generated by default as identity primary key,
    admin_username text unique not null,
    admin_password text not null
);

Run Locally

From the project root:

py .\LibraryManagementSystem\LoginRegisterSystem.py

Test Supabase Connection

py .\LibraryManagementSystem\authentication.py

Build the EXE

To package the app as a single Windows executable with the custom book icon:

py -m PyInstaller --onefile --windowed --icon .\asset\book.ico --add-data "asset\book.png;asset" --name LibraryManagementSystem .\LibraryManagementSystem\LoginRegisterSystem.py

Generated file:

.\dist\LibraryManagementSystem.exe

Security Note

This project currently stores passwords in plain text for both users and admins. That may be acceptable for a classroom demo, but it is not acceptable for production use. A real deployment should use hashed passwords and proper authentication flows.

Future Improvements

  • Hash user and admin passwords
  • Add form validation for all inputs
  • Restrict user permissions more clearly
  • Add book edit functionality
  • Improve UI styling and responsiveness
  • Add screenshots to this README

Author

Library Management System project for desktop-based book and account management.

About

A Python desktop Library Management System built with Tkinter and Supabase. Supports user/admin authentication, book searching, borrowing, returning, and inventory management, packaged as a Windows executable using PyInstaller. 📚

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages