Personal reading shelf tracker
The Bookshelf screen (route /library) lists every book in the catalog with title, author, page count, and cover art, and lets a signed-in reader record a reading status (WANT, READING, FINISHED) and current page for each book, showing a progress bar once tracked. Saving goes through a server action that validates the status/page combination and persists the shelf entry for that user and book.
Document details · v1
User flow
3user
Browse the list of available books
ResultThe grid shows every book's cover, title, author, and page count, plus the reader's own progress bar for books already tracked.
Interaction details
- all · auto
user
Mark a book as wanted, currently being read, or finished, and set the current page
ResultThe chosen status and page are saved for that book and the card now shows an updated progress bar and percentage.
Starts when · Reader is signed in
Interaction details
- desktop · submit
- mobile · submit
user
View the library without being signed in
ResultThe reader sees the book list and a sign-in prompt instead of the status/page form, and cannot record progress until signed in.
Interaction details
- all · auto
Business rules
4Policies and constraints the product must keep.
- 01ValidationBR-LIBRARY-01
A shelf status must be one of WANT, READING, or FINISHED; any other value is rejected.
Read linked criteria here
- AC-LIBRARY-02A signed-in reader who submits a valid status (WANT, READING, or FINISHED) with a matching page value receives a success result and the book card shows the updated progress.
- AC-LIBRARY-03Submitting a status/page combination that violates the page rules (e.g. WANT with a non-zero page, FINISHED with a page not equal to the book's length, or READING with the page equal to the book's length) is rejected with a validation error and status code 400, and no shelf entry is changed.
- 02ValidationBR-LIBRARY-02
The page value must be a non-negative integer not exceeding the book's page count; WANT requires page 0, FINISHED requires page equal to the book's total pages, and READING requires a page strictly less than the total pages.
Read linked criteria here
- AC-LIBRARY-02A signed-in reader who submits a valid status (WANT, READING, or FINISHED) with a matching page value receives a success result and the book card shows the updated progress.
- AC-LIBRARY-03Submitting a status/page combination that violates the page rules (e.g. WANT with a non-zero page, FINISHED with a page not equal to the book's length, or READING with the page equal to the book's length) is rejected with a validation error and status code 400, and no shelf entry is changed.
- 03PermissionBR-LIBRARY-03
Only a reader with a currently valid, non-expired session can save or update a shelf entry; an anonymous or expired-session request is rejected.
Read linked criteria here
- AC-LIBRARY-04A shelf-update request made without a valid signed-in session is rejected with status code 401 and no entry is saved.
- AC-LIBRARY-06An unauthenticated visitor sees a sign-in prompt in place of the status/page form and cannot submit shelf updates from the page.
- 04ValidationBR-LIBRARY-04
A shelf update must reference an existing book; updates for an unknown book identifier are rejected.
Linked criteria 1Criterion 05Read linked criteria here
- AC-LIBRARY-05A shelf-update request referencing a book identifier that does not exist is rejected with status code 404.
Acceptance criteria
6Expected outcomes. These entries do not claim a test was run or passed.
- 01CriterionAC-LIBRARY-01
Visiting the library shows every book in the catalog with its title, author, and page count, regardless of whether the visitor is signed in.
Linked rules 0 - 02CriterionAC-LIBRARY-02
A signed-in reader who submits a valid status (WANT, READING, or FINISHED) with a matching page value receives a success result and the book card shows the updated progress.
- 03CriterionAC-LIBRARY-03
Submitting a status/page combination that violates the page rules (e.g. WANT with a non-zero page, FINISHED with a page not equal to the book's length, or READING with the page equal to the book's length) is rejected with a validation error and status code 400, and no shelf entry is changed.
- 04CriterionAC-LIBRARY-04
A shelf-update request made without a valid signed-in session is rejected with status code 401 and no entry is saved.
Linked rules 1Rule 03 - 05CriterionAC-LIBRARY-05
A shelf-update request referencing a book identifier that does not exist is rejected with status code 404.
Linked rules 1Rule 04 - 06CriterionAC-LIBRARY-06
An unauthenticated visitor sees a sign-in prompt in place of the status/page form and cannot submit shelf updates from the page.
Linked rules 1Rule 03
Source files 21
- page.tsx
- LeafProvider.tsx
- useLeafState.ts
- useLeafLocale.ts
- locale.ts
- layout.tsx
- headings.tsx
- store.mjs
- initial-state.mjs
- password.mjs
- action-support.ts
- domain-error.mjs
- session.mjs
- validation.mjs
- types.ts
- FeatureFrame.tsx
- library.tsx
- BookCard.tsx
- actions.ts
- shelf.mjs
- actionView.ts
Source anchors are injected deterministically. No GitHub repository is connected. File links are unavailable.
