← All projects

Intermediate project · Week 5

Library Inventory System

Design a maintainable domain model with classes, encapsulation, and modules.

The problem

Modeling a real domain (books, members, loans) with classes is the clearest way to practice encapsulation and prototype-based design before scaling to a framework.

User stories

  • As a librarian, I want to add books with a title, author, and copy count, so I can track inventory.
  • As a librarian, I want to check a book out and back in, so I can track availability.
  • As a librarian, I want the available copy count to never go negative, so the data stays trustworthy.

Planning checklist

  • Design a Book class with private state for copy counts
  • Design a Library class that owns a collection of Books
  • List every invalid operation that must be rejected (checking out with zero copies, etc.)

Suggested data structure

class Book {
  #availableCopies;
  constructor(title, author, totalCopies) {
    this.title = title;
    this.author = author;
    this.#availableCopies = totalCopies;
  }
}

UI requirements

  • A form to add a new book
  • A list of books showing title, author, and availability
  • Checkout / return controls per book

Build milestones

Check off each milestone as you complete it — saved to this device.

…

0%

Testing checklist

  • Checking out the last available copy makes the book unavailable
  • Attempting to check out an unavailable book is rejected clearly
  • Returning a book increases available copies correctly

Completion criteria

…

0%

Progressive support

RequirementsPlanningStarterHintsReference Solution
Bonus features
  • Add member accounts and loan history
  • Add search/filter by author
  • Add a due-date and overdue calculation