Owami's Library — Dtech Collection

Digital Resource Collection
Back to Gateway

Overview (For Everyone)

What is it?

Owami's Library is a web-based e-book reader and library management application. It allows users to browse, search, organize, and read thousands of public domain books (primarily from Project Gutenberg) directly in their web browser without needing any extra software or apps.

What is it for?

It is designed to provide a seamless, beautiful, and distraction-free reading experience across both desktop and mobile devices. It offers features commonly found in premium reading apps, all running locally and directly in your browser.

Key Features:

How does it work?

When you open the site, it downloads a catalog of books. You can click on any book to open the reader. The reader fetches the book's text from the internet on-the-fly, formats it into "pages", and lets you read it like a real book. Everything you save—your favorites, your reading progress, your settings—is stored locally on your device, ensuring total privacy and speed.

---

Technical Architecture & Deep Dive (For Developers)

Owami's Library is a static Single Page Application (SPA) conceptually spread across two HTML pages (index.html for the library, reader.html for reading), backed by a serverless Cloudflare Worker (worker.js) acting as a CORS proxy.

System Flow & State Management

---

File Breakdown

1. `index.html` (The Library View)

Role: The main hub for browsing, searching, and managing the library.

Key Components & Logic:

2. `reader.html` (The Reader View)

Role: The isolated, distraction-free reading environment. Opened via URL parameters passed from index.html (e.g., reader.html?url=...&title=...).

Key Components & Logic:

3. `worker.js` (The Cloudflare Worker Proxy)

Role: The backend proxy to bypass browser CORS restrictions and optionally cache responses at the edge.

Key Components & Logic:

4. `data.txt`

Role: The static database file containing the catalog of books.

Structure:

The file follows a specific, human-readable text format parsed by regex chunking in index.html:


🎯 GENRE: Fiction
📖 BOOK 1: A Tale of Two Cities
👤 Author: Charles Dickens
📝 Text URL: https://www.gutenberg.org/files/98/98-0.txt
🖼️ Cover: https://www.gutenberg.org/cache/epub/98/pg98.cover.medium.jpg
------------------------

This simple format allows for easy manual updates while remaining machine-readable for the frontend parser.

---

Request Flow Summary

1. Initial Load: User hits index.html.

2. Catalog Fetch: index.html checks IndexedDB. If empty, it fetches data.txt directly from the same host, parses it, and populates the UI and cache.

3. Open Book: User clicks "Read". Browser navigates to reader.html?url=<Gutenberg_URL>.

4. Proxy Fetch: reader.html sends fetch('https://silent-brook.../?url=<Gutenberg_URL>&key=dtech_secret').

5. Worker Proxy: worker.js receives the request. Checks its edge cache. If miss, fetches <Gutenberg_URL>.

6. Worker Response: Worker attaches CORS headers, caches the response, and returns the text to reader.html.

7. Process & Render: reader.html strips boilerplate headers, chunks the large text string into pages, retrieves any saved page index from localStorage, and displays the content to the user.