Browse by type
https://github.com/user-attachments/assets/1c3a5138-0fc7-43e9-b0a2-761e70f9c83c
The open-source tool that provides access to premium Medium articles without the paywall
<a href="https://readiumx.com"><strong>Learn more »</strong></a>
<a href="#introduction"><strong>Introduction</strong></a> ·
<a href="#features"><strong>Features</strong></a> ·
<a href="#tech-stack"><strong>Tech Stack</strong></a> ·
<a href="#contributing"><strong>Contributing</strong></a>
ReadiumX is an open source tool that provides access to premium Medium articles without the paywall, allowing you to bookmark, and manage your reading experience across any device
bash
git clone https://github.com/JaleelB/readium-x.git
bash
pnpm install
.env.example to .env.local and update the variables.bash
cp .env.example .env.local
bash
pnpm run dev
This runs at http://localhost:3156. In this mode, Cloudflare bindings are
simulated through OpenNext's local dev bridge when available. If the
READIUMX_ARTICLE_CACHE binding is not available, scraping still works; it
simply skips the server-side KV cache and uses the existing client session
cache.
bash
pnpm run db:push
.dev.vars.example to .dev.vars, fill in the values, then run:bash
cp .dev.vars.example .dev.vars
pnpm preview
pnpm preview builds the OpenNext worker and starts Wrangler, usually at
http://localhost:8787. This is the mode to use when you specifically want
to verify the Cloudflare KV cache behavior before deployment.
ReadiumX deploys to Cloudflare Workers through OpenNext.
bash
pnpm wrangler kv namespace create readiumx-article-cache
pnpm wrangler kv namespace create readiumx-article-cache-preview
These commands create the real Cloudflare KV namespaces. They require
wrangler login locally or CLOUDFLARE_API_TOKEN in CI. For day-to-day
pnpm dev, you do not need to run them first; they are required before
deploying or testing against real Cloudflare resources.
Put the generated namespace IDs into wrangler.jsonc for the
READIUMX_ARTICLE_CACHE binding. Keep the production namespace as id and
the preview namespace as preview_id. If Wrangler offers to add the binding
for you, use READIUMX_ARTICLE_CACHE as the binding name; the app does not
read lowercase binding names.
Add the application variables and secrets from .dev.vars.example to Cloudflare Workers.
Add these GitHub repository secrets for deployment:
CLOUDFLARE_ACCOUNT_IDCLOUDFLARE_API_TOKEN
Preview or deploy:
bash
pnpm preview
pnpm deploy
open-next.config.ts uses OpenNext's KV incremental cache instead of the dummy
adapter. wrangler.jsonc binds NEXT_INC_CACHE_KV to the same production and
preview namespace IDs as READIUMX_ARTICLE_CACHE; no new namespace is needed.
If managing bindings in the dashboard, add a KV namespace binding named
NEXT_INC_CACHE_KV to the existing article-cache namespace before the next
approved deployment. Keep both bindings aligned if changing namespace IDs.
OpenNext uses build-scoped keys; extracted articles use article:v1:*.
The OpenNext deploy command populates prerendered cache entries automatically.
KV is eventually consistent and shares the existing namespace's quotas. This
is appropriate for the current public shells; it does not cache authenticated
SSR article/account responses. No ISR queue or tag cache is added: the current
revalidatePath calls concern dynamic protected pages. Adding cached data or
ISR with time-based/on-demand revalidation later requires the corresponding
queue/tag-cache setup described in the
OpenNext caching documentation.
The Worker also caches plain cookieless GET documents for /, /signin,
/signup, /forgot-password, and /reset-password for one hour at each
Cloudflare location, with separate keys for each host and path. Queries,
any Cookie or Authorization header, RSC/navigation requests, prefetches,
server actions, redirects, errors, Set-Cookie responses, and non-HTML responses
bypass this cache. Auth callbacks and protected pages are excluded. Responses
vary on Cookie and Authorization so browsers re-enter Clerk after sign-in.
x-readium-cache: hit|miss identifies eligible responses. The edge cache is
independent of OpenNext's incremental cache; purge the zone cache after a
release if these public shells must update before their one-hour TTL expires.
Anonymous /article and /article/* requests redirect to /signin before
OpenNext loads. Clerk cookies (including suffixed names), bearer credentials,
and Clerk handshake queries still reach the unchanged middleware for actual
session validation. Cookie presence never grants article access.
Scanner requests still count as Worker invocations when answered here, but
avoid Next/Clerk CPU. To stop matching requests before the Worker, optionally
add a zone WAF custom rule
that blocks known scanner paths such as /wp-*,
/.env, /.git, /admin, and PHP endpoints. Check Security Events and test
normal sign-in, callbacks, article reading, and the Clerk webhook first.
Bot Fight Mode
is another optional zone setting: monitor its challenges carefully because
WAF Skip rules cannot exempt traffic from Bot Fight Mode. These dashboard
changes are manual suggestions, not part of this PR's deployment.
Public files in public/ (robots.txt, sitemap.xml, manifests) are served by
Workers Static Assets because wrangler.jsonc sets assets.run_worker_first
to false. Leave that false. worker.ts is a second line of defense for
those paths, and it 404s scanner probes (.php, .env, wp-login, …) before
Next.js or Clerk load. It does not block crawlers by User-Agent.
Clerk stays installed. Middleware only runs on auth, account, article,
bookmark, and history routes. The homepage does not call auth(), so anonymous
and crawler traffic does not enter the handshake flow.
Production Clerk keys cannot be set from this repo. In the Cloudflare Worker
secrets for readiumx.com, set:
CLERK_SECRET_KEY to a live key (sk_live_...)NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY to the matching live key (pk_live_...)Clerk decides development vs production from the publishable key: anything
other than pk_live_ is a development instance. Cookieless document GETs then
redirect into the handshake, and a failed handshake token throws from
handleTokenVerificationErrorInDevelopment (HTTP 500) on every route that
still runs middleware (/signin, /account, …). sk_test_ paired with
pk_live_ is also wrong — signature checks fail. The worker logs a warning
when the production host is using non-live keys.
Redeploy after changing NEXT_PUBLIC_* values so the client bundle picks them
up; Worker secrets alone do not rewrite the already-built client script.
There is no HTTP→HTTPS or www→apex redirect in the app. Both readiumx.com and
www.readiumx.com are attached as Worker custom domains, so each host invokes
the Worker once. Cloudflare's "Always Use HTTPS" runs before the Worker and
does not double-execute it. If you want a single host, add a Cloudflare
Redirect Rule (Bulk Redirects or Single Redirects), not a redirect inside
middleware — a middleware redirect spends Worker CPU twice.
Optional follow-up, not required for this fix: remove Clerk only if accounts, bookmarks, and history are going away. The app still uses it for sign-in, protected pages, and the Clerk webhook.
If you want google login, you'll need to setup a google project and create some keys:
for authorized javascript origins
http://localhost:3000
https://your-domain.com
Authorized redirect URIs
http://localhost:3000/api/login/google/callback
https://your-domain.com/api/login/google/callback
Set your google id and secret inside of .env
GOOGLE_CLIENT_ID
If you want github login, you'll need to setup a github project and create some keys:
Contributions are welcome! Please open an issue if you have any questions or suggestions. Your contributions will be acknowledged. See the contributing guide for more information.
Licensed under the MIT License. Check the LICENSE file for details.
browse all types & interfaces →
$ claude mcp add readium-x \
-- python -m otcore.mcp_server <graph>