Case study 05 / Full-stack digital library
Bookhaven
A personal bookshelf, from storage to reading.
A digital library for organizing books, tracking reading progress and reading PDF or EPUB attachments, alongside a public collection of classics.

- Sign inServer accounts
- OrganizePrivate bookshelf
- AttachPDF or EPUB
- AuthorizeOwner-only access
- ReadIn-site reader
- ResumeSaved position
A bookshelf that connects records and reading.
Bookhaven brings book metadata, reading status, notes and attached files into one interface. Readers can add, search, edit, filter and remove books, then open a PDF or EPUB from their shelf. A separate public shelf provides five complete classics without requiring an account.
The live Render deployment is a static portfolio demo. It has no account system or cross-device sync: shelf records live in localStorage and attachments in IndexedDB. The repository also contains an Express server with private accounts.
One interface, two storage modes.
React and TypeScript provide the interface, with Vite building the frontend. The full-stack version runs one Express process that serves both the built frontend and API. Node.js’s built-in SQLite module stores users, sessions and book records; private attachments live on disk.
A build-time demo option switches API operations to a browser-local adapter. This keeps the static demo usable without a hosted database, while making its persistence limitations explicit.
Ownership checks follow the file.
The server hashes passwords with salted scrypt, stores hashes of random session tokens, and uses HttpOnly, SameSite=Lax cookies with Secure enabled for HTTPS requests. Mutating requests reject mismatched origins and cross-site fetch metadata; registration and login share an in-memory per-IP attempt limit.
Book queries and file routes check both the book identifier and authenticated account identifier. Uploads check declared type, extension, size and basic file signatures, then use generated filenames. These checks are implemented safeguards, not a claim of a comprehensive security audit.
Relational records and private attachments.
SQLite tables connect books and sessions to users through foreign keys. An owner-and-order index supports cursor-based book listing. Attachments are capped at 3 MB and stored separately from the database.
PDFs use the browser’s viewer. EPUBs are presented as text in section order, with adjustable type and a saved section. The EPUB reader does not reproduce images or complex layouts.
Integration tests and a static deployment.
The repository uses Node.js’s built-in test runner for integration tests covering durable, isolated account collections and validated, owner-only ebook downloads. These are implemented test cases; they are not presented here as a current CI result.
The Render Blueprint builds a static frontend with demo mode enabled. A Dockerfile is also provided for running the full-stack application with a persistent volume.
Simple hosting, explicit persistence limits.
Browser-local storage makes the live demo inexpensive to host, but clearing site data removes the shelf and files. Private browsing may not retain them, and the demo should not hold irreplaceable uploads.
The server’s SQLite database and uploads need a persistent volume and coordinated backups. This setup targets one application instance; multiple instances would require shared database and file storage. Paid books, checkout and publishing-rights management are outside the implemented scope.
Source reviewed at revision b22fdd8. View the reviewed snapshot.