* feat(vocabulary): entry model, sentence extraction and merge Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(vocabulary): revive a word looked up after a delete on a stale device Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat(vocabulary): local store, file persistence and backup Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat(wordlens): hint Learning words and skip Mastered words Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat(dictionary): Learning and Mastered chips, capture lookups to Vocabulary Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat(sync): vocabulary table and sync route Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat(sync): sync vocabulary across devices Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat(vocabulary): export to Anki and CSV Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat(vocabulary): hint sources from dictionaries and the AI context dictionary Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat(vocabulary): vocabulary builder window Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * chore(i18n): vocabulary strings Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(vocabulary): resolve the sync endpoint on use, not at import Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(vocabulary): save the lookup's sentence from its own paragraph with spacing kept Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(vocabulary): take a dictionary hint from the first definition, not the entry header Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(vocabulary): save a hint on Enter inside the Dialog Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(wordlens): re-render hints after the selection clears, keeping the dictionary open Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(vocabulary): leave ruby hints out of saved sentences, dedupe a sentence across CFIs Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(vocabulary): keep book text in its own direction under an RTL interface Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(vocabulary): a lookup never overrides a Learning or Mastered mark from another device A word first looked up on a device stamped modifiedAt with the current time, so its empty state beat a mark set elsewhere in the merge. Lookups now carry modifiedAt 0. Selections with no letters get no chips or entry. The migration moves to 032 (031 is taken on main). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(vocabulary): keep syncing past a bad row and cap saved sentences A rejected row failed the whole push, and the push's failure skipped the pull, so one bad word stopped vocabulary sync on that device. The server now skips malformed rows and reports them, the client clears them, and a failed push no longer prevents the pull. Sentences are cut to a window around the word and pushes go in batches of 50. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(vocabulary): rebuild from the server when the local word list is lost The pull cursor lives on the device apart from vocabulary.json. With the file missing or unreadable, the cursor still claimed everything was pulled, so the words never came back. Sync now starts over when the file held no words, trusts the cursor again after that full pull, and keeps a copy of an unreadable file before it is saved over. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(vocabulary): show typed hints as written; harden sentence capture and IME Enter A saved hint went through the pack gloss cleaner, which cut it at a comma or slash. A range the sentence reader couldn't handle could throw inside the annotator; it now falls back to the selected text. WebKit's IME-confirming Enter (keyCode 229) no longer saves the hint early. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(api): keep /api/sync/vocabulary off language detection and DOMPurify The vocabulary route syncs on every book open, so it joins the hot routes that #7274 keeps light. It passes as written: the route imports only the Supabase client, access check, CORS and the vocabulary entry/wire modules. Checked the case can fail: with `import '@/utils/sanitize'` added to the route it fails with `expected [ 'dompurify' ] to deeply equal []`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs(vocabulary): describe lookup capture without naming another reader Comment-only change; no behavior to test. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(vocabulary): drop the lookbehind from export bolding; guard CSV cells against formulas CodeRabbit on #7284. boldWord used (?<!…), which WebKit before 16.4 rejects and which failed the build's check:lookbehind-regex (build_web_app). It now consumes the boundary before the word in a capture group. CSV text cells that start with = + - @ tab or CR get a leading apostrophe, so a spreadsheet won't run book text or a hint as a formula. Tests that fail without it (export.test.ts): 'bolds whole words without lookbehind support' (RegExp throwing on lookbehind, as old WebKit does) and 'stops spreadsheet apps from running a cell as a formula'. pnpm build-web + pnpm check:all: no lookbehind in chunks. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(vocabulary): cap a saved sentence when the selection itself is over the limit CodeRabbit on #7284. With a selection of 300+ characters the window half was 0 and pre.slice(-0) kept the whole text before it. Such a selection is now cut to the limit on its own. Test that fails without it (entry.test.ts): 'caps a selection longer than the limit' (expected 414 to be less than or equal to 302). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(vocabulary): keep unpushed words pending when the word file loads CodeRabbit on #7284. load() merged the file into memory with mergeEntries, which drops the dirty flag, so a word restored from a backup or looked up before the file loaded was never pushed. Either side being dirty now keeps the merged word dirty, as applyRemote already does. Test that fails without it (vocabulary-store.test.ts): 'keeps unpushed changes pending when the file loads over them' (expected undefined to be true). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(api): keep database errors out of /api/sync/vocabulary responses CodeRabbit on #7284. The route returned PostgREST error messages to the client; it now logs them and returns a fixed message. A since_ts that isn't a timestamp gets a 400 before any query. Tests that fail without it (sync-vocabulary.test.ts): 'rejects a since_ts that is not a timestamp before querying' (expected 200 to be 400) and the two 'keeps database error details out of …' cases. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(vocabulary): run one more sync when one is asked for mid-sync CodeRabbit on #7284. A debounced sync that fired while a sync was running got the running promise back, so words changed after its push snapshot waited for the next change. It now sets a flag and the running sync makes one more pass. Fake timers in the sync tests are restored in afterEach. Test that fails without it (vocabularySync.test.ts): 'runs once more when a sync is asked for while one is running' (pull called 1 time, expected 2). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(wordlens): wait to draw hints when a selection starts while the pack loads CodeRabbit on #7284. whenSelectionClears guarded only the start of a refresh; a selection made while the gloss index or OpenCC loaded still had hints drawn under it, which can close the dictionary popup. The draw step now goes through whenSelectionClears and is dropped if a newer refresh ran. Tests (wordlens-section.test.ts): 'waits to draw hints when a selection starts while the pack loads' fails without it (expected [ '尼莫' ] to deeply equal []); 'drops a waiting draw once a newer refresh has run' guards the generation check. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(reader): give the Learning/Mastered chips a 32px hit target and focus ring CodeRabbit on #7284, per DESIGN.md (32px minimum hit target, the canonical focus-visible ring). Styling only. Checked on dev-web in Chrome: both chips measure 32px high in the dictionary popup, and Learning toggles on and off. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(vocabulary): drop the context when a selection leaves no room for it CodeRabbit on #7284. A 299-character selection skipped the over-limit cut, but the window half was still 0, and pre.slice(-0) kept the whole prefix. Context is now dropped whenever the half window is 0. Test that fails without it (entry.test.ts): 'caps the context when the selection leaves no room for it' (expected 701 to be less than or equal to 302). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(vocabulary): break merge ties on the display word too CodeRabbit on #7284. Two lookup-only copies of a word (same modifiedAt, state and hint) could keep "Serendipity" or "serendipity" depending on argument order, so devices and the server could show different forms. The tie key now ends with the display word. Test that fails without it (entry.test.ts): 'keeps the same display word whatever the argument order' (expected 'Serendipity' to be 'serendipity'). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(vocabulary): save pulled words to the data file before moving the cursor CodeRabbit on #7284. The pull saved its cursor right after applying a page, while the file write waited for the 500 ms save delay; quitting in between left the cursor past rows the file never got, and later pulls start from the cursor. The store gains flush(), and the pull awaits it before each cursor write. Test that fails without it (vocabularySync.test.ts): 'writes the pulled words to the data file before moving the cursor' (expected [ [] ] to deeply equal [ [ 'en:a' ] ]). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(wordlens): defer a whole hint refresh while text is selected CodeRabbit on #7284. The section-load refresh (and any other caller) cleared hints before checking the selection, which unwraps the <ruby> under it and can close the dictionary popup. refreshSectionGlosses now defers itself until the selection clears; its generation bump drops any older pending draw. Test that fails without it (wordlens-section.test.ts): 'leaves drawn hints alone until a live selection clears' (expected [] to deeply equal ['尼莫']). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(reader): save a new sentence for the same word while the dictionary stays open CodeRabbit on #7284. Lookup capture ran only when the word changed, so selecting the same word in another sentence with the popup still mounted saved nothing. It now also runs when the occurrence's book or sentence changes; repeat sentences are still deduplicated by the store. Test that fails without it (DictionaryVocabularyChips.test.tsx): 'records a new sentence for the same word while the popup stays open'. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(vocabulary): write the word file one save at a time, and never mid-load CodeRabbit on #7284: flush() cleared the save timer but not a save already writing, so that older write could land over the list flush() had just saved, after the pull had moved its cursor. Writes now run through one chain, each saving the list as it is when it starts. The same race reached backup restore, which wrote the file directly while a delayed save could still land over it. Backup and restore now flush first. A save that ran while the file was still loading wrote the partial list in memory over the file; saves now wait until it has loaded, and load saves the merged list when words were recorded before it finished. Tests that fail without it: - vocabulary-store.test.ts 'flush saves the newest list even while a delayed save is still writing' (expected [ 'en:first' ] to include 'en:second') - vocabulary-store.test.ts 'saves a word looked up while the file is loading, without dropping the file': without the loaded check, expected [ 'en:new' ] to deeply equal [ 'en:new', 'en:old' ]; without the save after load, expected [ 'en:old' ] to deeply equal [ 'en:new', 'en:old' ] - backup-vocabulary.test.ts 'includes a word saved moments ago…' (expected [] to include 'en:fresh') and 'keeps restored words when an earlier save finishes during the restore' (restored word overwritten) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(vocabulary): sync the restore race test on flush instead of a delay CodeRabbit on #7284: a fixed 50 ms wait didn't show the restore was blocked on the stalled save, so the test could pass or fail on timing. It now releases the stalled save only once the restore has called flush(), and always releases it so a failure can't stall later tests. Checked it still catches the bug: with restore's flush() removed it fails with 'expected "flush" to be called at least once'; with it, 3 passed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| volumes | ||
| .env.example | ||
| compose.build.yaml | ||
| compose.dev.yaml | ||
| compose.yaml | ||
| nginx.conf.example | ||
| README.md | ||
Self-Hosting with Docker/Podman with Compose
Stack
| service | Image | Description |
|---|---|---|
| client | ghcr.io/readest/readest |
readest frontend |
| db | supabase/postgres |
psql db with supabase extensions |
| kong | kong:2.8.1 |
api gateway routing requests to supabase services |
| auth | supabase/gotrue:v2.185.0 |
auth service (email, JWT) |
| rest | postgrest/postgrest:v14.3 |
psql rest api |
| minio | quay.io/minio/minio |
s3 storage |
| minio-setup | quay.io/minio/mc |
helper container to create s3 buckets |
Exposed ports
| Port | Service |
|---|---|
3000 |
readest |
8000 |
kong API gateway |
9000 |
MinIO S3 API |
9001 |
MinIO console UI |
Running with Docker/Podman Compose
1. setup .env
cp docker/.env.example docker/.env
update docker/.env:
- update
POSTGRES_PASSWORDto a strong password (32+ chars) - update
JWT_SECRETto a random secret (32+ chars) - regenerate
ANON_KEYandSERVICE_ROLE_KEYas HS256 JWTs signed with yourJWT_SECRET(use jwt.io or a similar tool):ANON_KEYpayload:{"role": "anon"}SERVICE_ROLE_KEYpayload:{"role": "service_role"}
- set
MINIO_ROOT_PASSWORDto a strong password
2. Start the Stack (pull prebuilt client image)
run from the docker/ directory:
cd docker
docker compose up -d
this pulls ${READEST_IMAGE} (default: ghcr.io/readest/readest:latest) instead of building the client locally.
the web client now reads SUPABASE_PUBLIC_URL, SUPABASE_ANON_KEY, API_BASE_URL, OBJECT_STORAGE_TYPE, SELF_HOSTED, STORAGE_FIXED_QUOTA, and TRANSLATION_FIXED_QUOTA from runtime
container env, so custom self-hosted values work with pulled images.
SELF_HOSTED unlocks every premium feature — third-party cloud sync (WebDAV,
Google Drive, S3, OneDrive), offline Read Aloud downloads, Send to Readest —
with or without a signed-in user. the image defaults it to true, so a pulled
image is unlocked even if your compose.yaml predates the variable. set
SELF_HOSTED=false in docker/.env only if you run a hosted service that sells
the plans.
if you prefer Docker Hub, set READEST_IMAGE in docker/.env, for example:
READEST_IMAGE=docker.io/your-dockerhub-username/readest:latest
replace your-dockerhub-username with the Docker Hub namespace that publishes your readest image.
for official images, use the namespace configured for this repository's Docker Hub publishing secrets.
published tags:
latest: rolling image from the default branch and from release events<release-tag>(for examplev1.2.3): published from release eventsmain: rolling image from the default branchsha-<commit>: immutable commit tag
OPDS catalogs on a private network
The web OPDS proxy blocks private, loopback and link-local addresses by default,
including public hostnames that resolve to them. To reach trusted LAN catalogs,
set an exact, comma-separated allowlist in docker/.env:
READEST_TRUSTED_PRIVATE_HOSTS=books.home.arpa,calibre.lan,192.168.1.20
Recreate the client with docker compose up -d client after changing it. With
docker run, pass -e READEST_TRUSTED_PRIVATE_HOSTS=books.home.arpa instead.
This setting is read by the server at request time and works with prebuilt
images; no rebuild or NODE_ENV change is needed.
Entries are hostnames or IP addresses only, without schemes, ports, paths,
wildcards or CIDR ranges. Matching ignores case and trailing DNS dots. An entry
allows any port on that host, so only list hosts whose services you trust.
For IPv6 literals, include brackets, for example [fd00::20].
Each redirect destination must pass the same checks. List any additional private hosts used for feeds, covers or downloads. Unlisted hosts keep the private-address and DNS checks, and credentials are still removed on cross-origin redirects. The allowlist applies only to OPDS, not KOSync or Send to Readest.
Anyone who can reach your Readest instance can use its OPDS proxy to reach the
listed hosts. Keep the instance behind your LAN/VPN or access controls when
allowing private services. SELF_HOSTED=true lets the catalog form submit LAN
URLs, but does not grant server access by itself.
Build locally instead of pulling
Prerequisites for local builds: the
packages/foliate-jsandpackages/simplecc-wasmgit submodules must be initialized before building:git submodule update --init packages/foliate-js packages/simplecc-wasmIn GitHub Codespaces this is done automatically via
.devcontainer/devcontainer.json.
cd docker
docker compose -f compose.yaml -f compose.build.yaml up --build -d
3. Access
- Readest app:
http://localhost:3000 - MinIO console:
http://localhost:9001(login withMINIO_ROOT_USER/MINIO_ROOT_PASSWORD)
Upgrading an existing deployment
pulling a newer client image does not touch the database volume, and the first-boot hook only runs when that volume is empty. so after an upgrade, apply any new migrations yourself:
cd docker
docker compose pull
docker compose up -d
docker compose exec db /docker-entrypoint-initdb.d/zz-readest-migrations.sh
the script records what it applied in readest_meta.migrations and skips those
next time, so it is safe to repeat after every upgrade.
if you had previously patched your database by hand, the script may stop on an
already exists error. record that file as applied and run it again:
docker compose exec db psql -U supabase_admin -c \
"INSERT INTO readest_meta.migrations (name) VALUES ('002_add_book_shares.sql') ON CONFLICT DO NOTHING"
Hot Reload (development)
Prerequisites: submodules must be initialized (see above).
to develop using the compose stack, use compose.dev.yaml which sets the build target to development-stage (Next.js dev server) and mounts your local repo for hot reload:
cd docker
docker compose -f compose.yaml -f compose.dev.yaml up --build -d
the first mount overlays your local repo into the container. the remaining anonymous volumes shadow the directories that were pre-built inside the image, so the container's installed deps and vendor assets are used instead of what's on your host.
Stop the Stack
cd docker
docker compose down
to also remove volumes (database and storage data):
cd docker
docker compose down -v
Database schema
| path | role |
|---|---|
volumes/db/init/schema.sql |
base schema (books, book_configs, book_notes, files) |
volumes/db/migrations/*.sql |
every schema change since, applied in filename order |
volumes/db/apply-migrations.sh |
applies the migrations and records them in readest_meta.migrations |
on an empty database volume the supabase image runs everything under
/docker-entrypoint-initdb.d in glob order: its own migrate.sh (supabase core
schema plus init-scripts/100-schema.sql, which is schema.sql), then
zz-readest-migrations.sh, which is apply-migrations.sh. it globs the mounted
migrations directory, so adding a migration file needs no compose change.
Serving from a custom domain
the browser talks to three of these services directly, so each needs a URL that resolves from outside the docker network:
| variable | what the browser uses it for |
|---|---|
SITE_URL |
the readest client itself |
SUPABASE_PUBLIC_URL |
kong, which routes /auth/v1/… and /rest/v1/… |
S3_PUBLIC_ENDPOINT |
minio, reached through path-style presigned URLs |
SUPABASE_PUBLIC_URL and S3_PUBLIC_ENDPOINT default to http://${HOST_IP}:<port>,
which suits a plain IP/port deployment; set them in docker/.env to override that.
putting everything on one origin also means no cross-origin requests at all:
HOST_IP=your-domain.com
SITE_URL=https://your-domain.com
API_EXTERNAL_URL=https://your-domain.com
ADDITIONAL_REDIRECT_URLS=https://your-domain.com/**
SUPABASE_PUBLIC_URL=https://your-domain.com
S3_PUBLIC_ENDPOINT=https://your-domain.com
nginx.conf.example is a working starting point for terminating TLS in front of
the stack. two things it gets right that are easy to miss: the Host header has
to reach minio unchanged or the presigned signatures will not verify, and the
request body limit has to be lifted on the bucket location or large book uploads
are truncated.
CJK fonts on a custom domain
the reader loads a few CJK webfont bundles from Readest's CDN, which only sends
Access-Control-Allow-Origin for readest.com origins, so the browser blocks them
on a self-hosted domain. mirror
https://storage.readest.com/public/font/dist/<Family>/ (and the .woff2 files it
references) onto a path your proxy serves, then point the client at it:
FONT_BASE_URL=https://your-domain.com/fonts
leaving FONT_BASE_URL empty keeps the default CDN. system and Google fonts are
unaffected either way.
Building the Dockerfile standalone
docker build \
--target production-stage \
--build-arg NEXT_PUBLIC_APP_PLATFORM=web \
-t readest-client \
.
run the built image:
docker run -p 3000:3000 \
-e SUPABASE_URL=http://host.docker.internal:8000 \
-e SUPABASE_PUBLIC_URL=http://localhost:8000 \
-e SUPABASE_ANON_KEY=<anon-key> \
-e SUPABASE_ADMIN_KEY=<service-role-key> \
-e API_BASE_URL=http://localhost:3000 \
-e OBJECT_STORAGE_TYPE=s3 \
-e S3_ENDPOINT=http://host.docker.internal:9000 \
-e S3_PUBLIC_ENDPOINT=http://localhost:9000 \
-e S3_REGION=us-east-1 \
-e S3_BUCKET_NAME=readest-files \
-e S3_ACCESS_KEY_ID=<minio-user> \
-e S3_SECRET_ACCESS_KEY=<minio-password> \
-e STORAGE_FIXED_QUOTA=1073741824 \
-e TRANSLATION_FIXED_QUOTA=50000 \
readest-client
on Linux, some Docker setups do not resolve host.docker.internal by default.
in that case, either replace it with your host IP or run with:
--add-host=host.docker.internal:host-gateway.