Reader is a local-first Android e-reader for language learners. It turns selected words into AI-generated vocabulary cards, schedules reviews with FSRS, and supports offline dictionaries. A Spring Boot backend handles accounts and AI jobs, while a separate stateless worker calls AI providers. The same backend powers a web workspace for translating books, keeps every translated book in its own Git repository, and delivers vocabulary exercises through Telegram.
When reading in a foreign language, looking up an unknown word usually means switching to a separate dictionary, losing the context and returning to the text. Reader combines these steps in one workflow: the user selects a word, receives a card with a translation, pronunciation and examples of use, and the app schedules the next review.
The screenshots are from the Google Play build. Reading imported books, lookups in downloaded dictionaries and vocabulary reviews work offline. AI features and online catalogs require a network connection.

The app imports EPUB, PDF, DjVu, FB2 and TXT through the system picker. Metadata and cover images are extracted locally; reading progress is saved for each book.

A pull from the bottom edge opens a carousel of rendered page previews for moving quickly through the book. The same tools sheet contains bookmarks and notes; the progress slider scrolls the previews live and commits the new position on release.

Selecting a word opens its vocabulary card: translation, grammar notes, pronunciation audio and a video example of native speakers using the word.

Selecting a sentence or paragraph opens a separate translation sheet. The fragment is translated with sentence context through the server-side AI pipeline; the result can be copied or saved as a vocabulary card.

Dictionary packs are downloaded from the server once; subsequent lookups are local and do not require a network connection. Unresolved lookups are reported without context or user identity — only the word and language — so the packs can be improved.

Every card enters an FSRS review queue — source-to-target, target-to-source or mixed. The scheduler is implemented in Kotlin and runs entirely offline.

OPDS catalogs, including Project Gutenberg, can be browsed inside the app; a selected book is imported like a local file.
Each component was added in response to a concrete requirement rather than to complicate the architecture.
Compose app, Room storage, format-specific reading engines, progress and bookmarks. No account required; guest mode remains available.
Creating cards and translations incurs a cost for each model call. A Spring Boot backend was added for accounts, JWT sessions, entitlements and per-user rate limits; provider credentials are never stored in the app.
A shared service that does not store user state (plexus-ai) handles the integrations with AI providers. The backend implements its side of the job protocol: submission, claiming, events and retries.
A Vue workspace was added on the same backend: book upload, translation in chunks, a glossary and alignment review. Book translation uses a separate entitlement because it is significantly more resource-intensive.
Book translations use the same version-control mechanisms as source code. A standalone module represents every book as a Git repository: snapshots, branches, merges, suggestions and updates from the upstream project.
A bot generates cloze and multiple-choice exercises from the user’s vocabulary-card history; free-form answers are evaluated by the same AI pipeline.
The Android app and the translation SPA connect to the backend directly. Telegram users reach the bot through Telegram's Bot API, which the backend long-polls. The backend exposes two security boundaries: a public API protected by JWTs and entitlement checks, and an internal API reserved for trusted services.
A dashed border marks components deployed separately from this repository. The app, SPA and bot use only the public API; the AI worker and mail relay use only the internal API.
The monolith is a deliberate choice: it is inexpensive to operate and easier to reason about. The important boundaries are inside the application rather than between containers.
Reading data stays on the device; the server stores only what its services need. On the server, PostgreSQL is the authoritative store: Flyway manages the schema, and the application validates its entities against it.
Each translated book also has a bare Git repository on disk. The repository preserves its version history; the database rows support the active workflow.
Session tokens are encrypted with an Android Keystore-backed key and are not stored in the database. None of this data is required on the server — uninstalling removes the local copy.
There is no message broker or WebSocket on the critical path. The important property is the direction of the exchange: the AI worker calls the server, not the other way around.
A user long-presses the word éphémère in a French novel. The following steps show how the request passes through the system and becomes a card.
The JS layer in the page captures the selection with sentence context and calls the Kotlin bridge.
Authorization: Bearer … — the JWT carries the user's entitlements.
AI_ACCESS authority → per-user hourly rate limit → fingerprint cache. A repeat lookup returns instantly.
Persisted in ai_jobs with a requestId that will correlate every later event.
The worker's long-poll request to /claim?wait=30 returns the job — no inbound port needed on the worker.
plexus-ai calls the model. Provider credentials are never exposed to the core backend or the app.
/jobs/{id}/events reports completion. finishReason decides: stop is success, max_output_tokens triggers one retry with a higher limit, refusals are returned without a retry.
The response is schema-validated server-side; an invalid result triggers exactly one corrective retry.
The app's GET /api/v1/jobs picks up the result; the card is saved to Room and FSRS assigns its first review.
The goal isn't to encrypt everything — it's avoiding the transfer of the user’s personal library to the server in the first place.
Format-specific engines implement the same interface; a bundled JavaScript layer does the typesetting inside WebView.
To reduce layout costs for very long PDF documents, each source page became a section with content-visibility: auto and a measured intrinsic height — the layout cost of a 200-page document dropped to whatever was on screen. But restoring a saved position suddenly started taking the reader back to page one and overwriting the saved position with {"index":0}.
The mechanism was subtle: skipped sections left Blink's scroll-anchoring algorithm without a stable anchor, so ~150 ms after a correct restore the engine silently reset scrollTop to zero. The app's heuristic — "moved >4px means the user scrolled" — treated that as a gesture, released the position-restoration lock and saved the zero. The fix, verified on a device: disable overflow-anchor on the feed, keep the pin until a real touch/pointer/wheel gesture, and re-assert the target while the layout settles.
The second half of the product: a web workspace that translates entire books — and a versioning engine that treats translated text like source code.
One Docker build produces the jar and the SPA. Deployment is deliberate: the image is built on the Plexus VPS and the reader service is restarted by hand — a merge is never silently live.
The complete system on one diagram. Clients are shown at the top, security boundaries in the middle, and data stores and external services at the edges.