Design a Multi-Branch Library Lending System

Quick Overview

Design a multi-branch library system for catalog search, reservations, checkout, returns, and branch-level copy availability. Explore concurrency-safe loan state, search consistency, idempotent workflows, and recovery when notifications or branches fail.

Design a Multi-Branch Library Lending System

Company: Amazon

Role: Software Engineer

Category: System Design

Difficulty: medium

Interview Round: Technical Screen

Design a library management system shared by multiple library branches. It must support catalog search, branch-level availability, reservations, checkout, and return. A bibliographic title may have many physical copies across branches, but the same copy must never have overlapping loans. ### Constraints & Assumptions - Separate title-level metadata such as ISBN from the identity and state of each physical copy. - A return should make the copy available and complete the loan even if a downstream notification is temporarily unavailable. - Search must support title lookup and finding branches that currently have a requested title. - Reservation policy, loan duration, and transfer between branches should be clarified rather than invented. ### Clarifying Questions to Ask - Is a reservation for any copy of a title at one branch, or for one specific physical copy? - Can a copy be transferred between branches while reserved or checked out? - Must checkout and return work while a branch is temporarily disconnected? - What consistency is required between the search index and transactional copy availability? ```hint Put contention on the physical copy Two patrons can request the same title concurrently, but only a conditional state transition on one copy can create a valid loan. ``` ### What a Strong Answer Covers - Catalog, copy, branch, patron, reservation, and loan models with explicit identifiers and state transitions. - Search and availability indexes, including their consistency relationship to the transactional source of truth. - Concurrency-safe reservation, checkout, and return operations that prevent overlapping loans. - Transactional outbox notifications, idempotency, failure recovery, indexing, partitioning, and auditability. ### Follow-up Questions - How would you prevent two branches from checking out the same transferred copy during a race? - What happens when a return commits but the hold-notification service is down? - How would you answer “which nearby branches have this ISBN now?” without trusting a stale search document?

Quick Answer: Design a multi-branch library system for catalog search, reservations, checkout, returns, and branch-level copy availability. Explore concurrency-safe loan state, search consistency, idempotent workflows, and recovery when notifications or branches fail.

|Home/System Design/Amazon
Amazon logo
Amazon
Jun 4, 2026, 12:00 AM
mediumSoftware EngineerTechnical ScreenSystem Design
0
0

Design a library management system shared by multiple library branches. It must support catalog search, branch-level availability, reservations, checkout, and return. A bibliographic title may have many physical copies across branches, but the same copy must never have overlapping loans.

Constraints & Assumptions

  • Separate title-level metadata such as ISBN from the identity and state of each physical copy.
  • A return should make the copy available and complete the loan even if a downstream notification is temporarily unavailable.
  • Search must support title lookup and finding branches that currently have a requested title.
  • Reservation policy, loan duration, and transfer between branches should be clarified rather than invented.

Clarifying Questions to Ask Guidance

  • Is a reservation for any copy of a title at one branch, or for one specific physical copy?
  • Can a copy be transferred between branches while reserved or checked out?
  • Must checkout and return work while a branch is temporarily disconnected?
  • What consistency is required between the search index and transactional copy availability?

What a Strong Answer Covers Guidance

  • Catalog, copy, branch, patron, reservation, and loan models with explicit identifiers and state transitions.
  • Search and availability indexes, including their consistency relationship to the transactional source of truth.
  • Concurrency-safe reservation, checkout, and return operations that prevent overlapping loans.
  • Transactional outbox notifications, idempotency, failure recovery, indexing, partitioning, and auditability.

Follow-up Questions Guidance

  • How would you prevent two branches from checking out the same transferred copy during a race?
  • What happens when a return commits but the hold-notification service is down?
  • How would you answer “which nearby branches have this ISBN now?” without trusting a stale search document?

Submit Your Answer to Earn 20XP

Sign in to leave a comment

Loading comments...