Arkhins - Emblem

projects2025 · Full-stack · Live

Bookisham

Private Reading Room

Bookisham is a members' library that never hands over a file. Readers sign in on any device and read page by page from a canvas; an admin runs the shelf, the readers and the purchases. One Next.js server, two front doors: an installable web app and a native Android app.

Bookisham, cover
Role
Design, full-stack, Android
Server
Next.js 15 · Postgres on Neon · S3
App
Kotlin · Jetpack Compose · Material 3
Status
Live, v1.0.5 on Android

2
Apps, one server
3
Formats: PDF, EPUB, Word
48 h
Session, one device
0
Files ever downloaded

01 · Overview

A library that lends, never gives.

Most reading apps hand the reader a file and hope for the best. Bookisham keeps the file: every book is paginated on upload, stored encrypted, and served one rendered page at a time through a session that belongs to exactly one device.

Readers create their own account, browse the shelf with prices and discounts up front, pay by UPI and attach the screenshot; an admin approves the request by eye and the book appears on the reader's shelf with a notification. The page they stop on is saved as they go, so a reload, or another device, lands on the same line.

The web app installs as a PWA and the Android app is native Kotlin with Jetpack Compose. Both speak to the same JSON routes, share the same one-device rule, and paint pages the same way: unwrapped in memory, drawn, and dropped.

Read, never download
Pages are rendered on the server and painted onto a canvas. There is no file, no image URL and no text in the DOM.
One device at a time
A login ends every other session for that account. Sessions last 48 hours, whether or not the reader is active.
Text off the clipboard
Selection, copy, print and dev-tools shortcuts are swallowed; the page is covered when the window is not in front.
UPI purchases
Prices and discounts per book, a QR to pay, a screenshot as proof, and an admin decision that notifies the reader.
Encrypted shelf
Books, covers and rendered pages are AES-256-GCM encrypted in the app before they reach S3. A public bucket would leak ciphertext.
Updates from GitHub Releases
A tagged push builds and signs the APK; the app checks the release feed, downloads inside the app and hands off to the installer.

02 · Two front doors

Same shelf, every device.

The server renders its pages for the browser and exposes the same shapes as JSON for the phone. Whichever door a reader walks through, the shelf, the progress and the rules are identical.

In the browser · Next.js 15

An installable web app

Server-rendered pages on warm paper, with a service worker that keeps the shell offline-ready and stays away from anything that carries a page of a book.

  • App Router, React 18, Tailwind
  • Fraunces for display, Inter for body
  • Install button and manifest for the home screen
  • Cache-Control: no-store on every page of a book
The library on a phone

On the phone · Kotlin

Native on Android

Shown here: the web app installed on a phone. The Android app mirrors every screen in Jetpack Compose with no third-party UI library, and adds what only a native app can.

  • FLAG_SECURE: the OS refuses screenshots and recording
  • Pinch and double-tap zoom about the fingers
  • Pages held in an LruCache bounded to a third of the heap
  • Notifications raised in the tray by a background worker

Shared by both

  • POST /api/auth/login
  • GET /api/me
  • GET /api/library
  • GET /api/browse
  • GET /api/books/:id
  • GET /api/read/:book/:page
  • POST /api/progress
  • POST /api/purchase-requests
  • GET /api/notifications
  • /api/admin/*
  • bk_session cookie · 48 h
  • one device per account

03 · Under the hood

Three pipelines, one promise.

Upload, read, protect. Each is a small chain of steps, and each ends with the same outcome: the reader sees the page and nobody holds the file.

UploadFrom a file to numbered pagesshow
  1. 01Accept PDF, EPUB or Word. The admin drops a file with an optional cover, title, author, price and discount.
  2. 02Lay out reflowable formats. Word goes through mammoth to HTML; EPUB and HTML are laid out at A4 so every book has fixed, numbered pages.
  3. 03Paginate with MuPDF. The page count is stored with the book; it is what progress and the scrubber count against.
  4. 04Encrypt, then upload. Each object is sealed with AES-256-GCM using a key only the server holds, then put under one prefix in the bucket.
  5. 05Render covers and pages on demand. The first request for a page renders it at the asked scale and caches the result, encrypted, next to the book.

Pieces

  • mupdf
  • mammoth
  • sharp
  • AES-256-GCM
  • @aws-sdk/client-s3
  • Neon Postgres
  • schema applied on first boot
  • stateless with S3
ReaderFrom a request to a painted pageshow
  1. 01Open through the session. The page route checks the reader may open this book, then hands the browser the start page, the page count and a per-session key.
  2. 02Fetch one page at a time. Slots near the viewport ask for their page at scale 2 on phones and 3 on wide screens, the sharpest the server renders.
  3. 03Unwrap in memory. Page bytes arrive wrapped with the session key and are unwrapped just before painting. There is no URL that returns an image.
  4. 04Paint onto a canvas. No <img>, no text in the DOM. Bitmaps live in a small cache and are closed when the reader unmounts.
  5. 05Remember the line. The slot crossing the middle of the viewport is the current page: saved locally at once and posted to the server after 600 ms of quiet.

Details

  • canvas only
  • ImageBitmap cache
  • page scrubber
  • fit-to-width zoom
  • keyboard paging
  • no service worker on /read
  • Cache-Control: no-store
ShieldKeeping the text off the clipboardshow
  1. 01Block the obvious. Selection, drag, right-click, copy, cut, save, print and view-source are refused on the reading surface.
  2. 02Watch for the tools. Dev-tools shortcuts are swallowed and the window size is polled; when the tools look open, the pages are covered.
  3. 03Cover when you look away. Losing focus, hiding the tab or pressing PrintScreen covers every page, and the clipboard is overwritten.
  4. 04Sign every page. The reader's own email is tiled faintly across each page. Whatever leaves, leaves with a name on it.
  5. 05Go further on Android. FLAG_SECURE makes the OS itself refuse screenshots and recording, and blanks the app in the recents switcher.

Honest limits

  • Permissions-Policy: display-capture=()
  • no-store everywhere
  • ⚠ cannot stop a camera
  • ⚠ cannot stop a rooted phone
  • deterrent, not a guarantee

04 · Key screens

From the front door to the last page.

The front door

One photograph, edge to edge, and the two things a visitor came for: how to reach us and where to sign in. The shelf is listed for everyone, with prices, so a visitor knows what is inside before creating an account.

  • WhatsApp or email contact menu
  • Install prompt for the PWA
  • Three steps, terms and privacy

The shelf

A reader sees only the books they have been given, each with an ember progress bar and the page they are on. An admin sees every book, which is how they check what a reader will see.

  • Progress saved per reader per book
  • Opens on the page you left
  • Session expiry shown plainly

The reader, at night

A near-black surface so a white page does not glare in a dark room, one floating bar with zoom and a page scrubber, and a column of pages painted from bitmaps that never touch the disk.

  • Canvas pages, no image URLs
  • Scrubber, page jump, keyboard paging
  • Email watermark tiled across every page

When you look away

The moment the window loses focus, the tab is hidden, the developer tools open or PrintScreen is pressed, the pages disappear behind a cover. Come back and they return where they were.

  • Blur, visibility and size polling
  • Clipboard overwritten on PrintScreen
  • Same rule as FLAG_SECURE on Android

The admin's desk

Everyone with an account, when they were last seen and how many books they hold. A new reader's password is shown exactly once; from a reader's page the admin ticks books, resets the password, signs a device out or disables the account.

  • Password shown once, sent on by hand
  • Sign out device ends the session at once
  • Per-reader book access

Books and purchases

Upload a PDF, EPUB or Word file with a cover, a price and a discount; edit or replace it later. Purchase requests arrive with the reader's UPI screenshot and are approved or rejected by eye, which grants the book and notifies the reader.

  • Prices and discounts per book
  • Manual UPI review, no gateway
  • Release notes broadcast to every reader

05 · In the pocket

Installed, not bookmarked.

Landing on a phone
Browse on a phone
The reader on a phone
The library on a phone
Account on a phone

06 · Threat model and stack

What it stops, and what it can't.

It stops

  • Downloading or saving the file
  • Selecting, copying or printing text
  • Image URLs that can be shared
  • Reading on two devices at once
  • Reading past a disabled account or reset password
  • Reading a bucket object without the server's key

It cannot stop, so the watermark exists

  • A camera pointed at the screen
  • A hardware screenshot on the web (Android refuses via FLAG_SECURE)
  • A screen recorder outside the browser
  • A rooted phone reading its own memory

Stack

  • Next.js 15
  • React 18
  • TypeScript
  • Tailwind CSS
  • Postgres on Neon
  • pg
  • S3 · @aws-sdk
  • MuPDF
  • mammoth
  • sharp
  • Web Crypto
  • Service worker
  • Kotlin
  • Jetpack Compose
  • Material 3
  • OkHttp
  • kotlinx.serialization
  • Navigation Compose
  • WorkManager
  • GitHub Actions

Operations

  • Schema applied on first start; first admin created from env
  • Stateless server once S3 is configured
  • Tagged push builds, signs and publishes the APK with SHA256SUMS
  • App checks GitHub Releases and installs in place
  • New release broadcast to every reader once

07 · More screens

The rest of the room.

Open any screen to see it full size.

Sign up with terms agreement
Sign in
Browse every book
Account, with copyable IDs
Notifications
A reader's books and actions
Purchase requests
Terms and conditions