Skip to content
Michael Lizzio

Library Database & REST API

A library system built in layers while learning PostgreSQL, Python, and REST

  • Python
  • PostgreSQL
  • Flask
  • Flask-RESTful
  • SQL
  • REST API
  • psycopg2
  • Unit testing

RIT SWEN 344 coursework

This was the main project I built while learning full-stack development in SWEN 344. I first modeled a multi-branch library in PostgreSQL and wrote its business logic in Python, then turned the same system into a Flask REST API with users, sessions, book management, and history. It was a useful way to learn how a database, domain layer, and HTTP API fit together.

Building the database first

Entity relationship diagram for the library database showing users, inventory, books, libraries, statuses, categories, and book history
The PostgreSQL model behind the library system.

The first version was a Python library system built directly on a ten-table PostgreSQL database. It handled users, books, physical inventory copies, multiple library branches, checkout history, reservations, returns, overdue lockouts, CSV imports, and reports.

Books and physical copies were kept separate, so several branches could hold copies of the same title. Book history worked like an event log. Returning a book could automatically find the oldest reservation and check that same copy out to the person who had been waiting longest.

Turning it into a REST service

The second phase put Flask-RESTful endpoints in front of the database and business logic. The API could create and update users, log them in and out, search books, check out, return, or reserve a book, and filter borrowing history.

This phase also added session tokens and password hashing. Tests called the running server over HTTP, which gave me practice testing the complete path from a request through the API and Python code into PostgreSQL.

What the course connected

The larger SWEN 344 workspace continued from PostgreSQL to Python data access, Flask APIs, and React clients. I also built a nutrition tracker and a vending-machine interface, but this page stays focused on the library system because it shows the database-to-REST progression most clearly.