Blog
Wild & Free Tools

Class Diagram for Library Management System: Complete UML Example

Last updated: January 27, 2026 6 min read

Table of Contents

  1. Core catalog: Book, Author, Category
  2. Members and accounts
  3. Loans and reservations
  4. Catalog search and notifications
  5. Frequently Asked Questions

Library management systems are a staple of software engineering courses and OOP design exercises. They have a manageable number of entities, clear relationships, and enough complexity to demonstrate inheritance, composition, association, and aggregation in one diagram.

This post provides a complete class diagram for a library management system in Mermaid syntax — paste directly into the free Badger tool and export PNG or SVG.

Core Catalog: Book, Author, and Category

classDiagram
  class Book {
    +String isbn
    +String title
    +String publisher
    +int publishYear
    +int totalCopies
    +int availableCopies
    +float price
    +isAvailable() bool
    +getAuthors() List
  }
  class BookCopy {
    +String copyId
    +String condition
    +String location
    +bool isCheckedOut
    +getStatus() String
  }
  class Author {
    +String authorId
    +String name
    +String nationality
    +String biography
    +getBooks() List
  }
  class Category {
    +String categoryId
    +String name
    +String description
    +getBooks() List
  }
  Book *-- BookCopy
  Book "0..*" --> "1..*" Author : written by
  Book "0..*" --> "1..*" Category : belongs to

Book owns BookCopies (composition) — there is no abstract BookCopy floating around without a parent Book. Authors and Categories are associated rather than composed because they exist independently of any specific book.

Library Members

classDiagram
  class Member {
    <<abstract>>
    +String memberId
    +String name
    +String email
    +String phone
    +Date membershipExpiry
    +int maxBooksAllowed
    +isActive() bool
    +renewMembership() void
  }
  class StudentMember {
    +String studentId
    +String institution
    +String course
    +int yearOfStudy
  }
  class PublicMember {
    +String address
    +String idDocumentType
    +String idNumber
  }
  class LibraryStaff {
    +String staffId
    +String role
    +String department
    +issueBook(member, copy) Loan
    +returnBook(loan) void
  }
  Member <|-- StudentMember
  Member <|-- PublicMember
Sell Custom Apparel — We Handle Printing & Free Shipping

Loans and Reservations

classDiagram
  class Loan {
    +String loanId
    +Date issueDate
    +Date dueDate
    +Date returnDate
    +String status
    +float fineAmount
    +isOverdue() bool
    +calculateFine() float
    +returnBook() void
    +renew() bool
  }
  class Reservation {
    +String reservationId
    +Date reservedOn
    +Date expiryDate
    +String status
    +cancel() void
    +convertToLoan() Loan
  }
  class Fine {
    +String fineId
    +float amount
    +String reason
    +Date issuedDate
    +bool isPaid
    +pay() void
  }
  Member "1" --> "0..*" Loan : has
  Member "1" --> "0..*" Reservation : makes
  BookCopy "1" --> "0..1" Loan : in
  Book "1" --> "0..*" Reservation : for
  Loan "1" --> "0..1" Fine : incurs

Catalog Search and Notification System

classDiagram
  class Catalog {
    +searchByTitle(query String) List
    +searchByAuthor(name String) List
    +searchByIsbn(isbn String) Book
    +searchByCategory(category) List
    +getAvailableBooks() List
    +getNewArrivals() List
  }
  class Notification {
    +String notificationId
    +String type
    +String message
    +DateTime sentAt
    +bool isRead
    +markRead() void
  }
  class DueDateReminder {
    +Loan loan
    +int daysBeforeDue
    +send() void
  }
  class OverdueNotice {
    +Loan loan
    +float currentFine
    +send() void
  }
  Notification <|-- DueDateReminder
  Notification <|-- OverdueNotice
  Member "1" --> "0..*" Notification : receives
  Catalog ..> Book : searches

Try It Free — No Signup Required

Runs 100% in your browser. No data is collected, stored, or sent anywhere.

Open Free Class Diagram Tool

Frequently Asked Questions

Should BookCopy use composition or aggregation with Book?

Composition. A BookCopy only exists as a physical instance of a specific Book — if the Book record is deleted, its copies are deleted too. There is no independent lifecycle for a copy outside its parent Book.

Why is Member shown as abstract?

Because every real library member is either a student or public member (or staff) — there is no generic "Member" you can actually register. Abstract forces the design to explicitly handle different member types with their own attributes.

What is the relationship between Book and Reservation?

Association: a Member makes a Reservation for a specific Book (not a specific copy — when the copy becomes available, it gets assigned). Cardinality: one Book can have many Reservations from different members.

How do I export this diagram?

Paste any Mermaid code block into the Badger Class Diagram tool. The diagram renders live. Click Export PNG for a high-resolution image or Export SVG for a vector file. No account needed.

Stephanie Ward
Stephanie Ward Diagram & Visual Documentation Writer

Stephanie spent eight years as a business analyst creating flowcharts, ERDs, and process diagrams for enterprise software teams. She makes diagram creation approachable for teams without a dedicated designer.

More articles by Stephanie →
Launch Your Own Clothing Brand — No Inventory, No Risk