Cloudflare Worker that stores a curated reading list in KV and exposes JSON, Markdown, and RSS endpoints.
- Cloudflare account
- Node.js 18+
- Wrangler CLI
Install Wrangler:
npm install -g wranglerLogin:
wrangler loginMinimal HTML reading log page (use for your subdomain).
Optional query params:
limit(default5, max20)
Returns JSON list of items (newest first).
Query params:
limit(default5, max20)
Returns a Markdown list for README embedding.
Query params:
limit(default5, max20)
Returns an RSS feed.
Query params:
limit(default5, max20)
Adds an item. Requires auth.
Headers:
Authorization: Bearer $READING_TOKENorX-Reading-Token: $READING_TOKEN
JSON body:
{
"title": "Article title",
"url": "https://example.com/article",
"added_at": "Optional ISO timestamp"
}Removes an item by URL. Requires auth.
Headers:
Authorization: Bearer $READING_TOKENorX-Reading-Token: $READING_TOKEN
JSON body:
{
"url": "https://example.com/article"
}Returns 404 if no item matches the given URL.
- If title length is 85+, truncate to 80 characters and append
…. - If title length is 84 or less, display the full title.
-
Create a KV namespace and bind it in
wrangler.tomlasREADING_KV.wrangler kv namespace create READING_KV wrangler kv namespace create READING_KV --preview
-
Add the KV IDs to
wrangler.toml. -
Optionally store your token locally in
.env(do not commit it):cp .env.example .env # edit .env and set READING_TOKEN -
Set the write token in Cloudflare:
wrangler secret put READING_TOKEN
Hint: Use a long random string, e.g.
openssl rand -hex 32.You will be prompted to create a Cloudflare Worker if one does not exist yet. Select "yes" to create one.
-
Optional metadata (set in
wrangler.tomlunder[vars]or via secrets):wrangler secret put READING_SITE_TITLE wrangler secret put READING_SITE_URL wrangler secret put READING_MORE_URL
-
Deploy:
wrangler deploy
curl -X POST https://YOUR_WORKER_URL/reading/add \
-H "Authorization: Bearer $READING_TOKEN" \
-H "Content-Type: application/json" \
-d '{"title":"Example title","url":"https://example.com"}'curl -X DELETE https://YOUR_WORKER_URL/reading/remove \
-H "Authorization: Bearer $READING_TOKEN" \
-H "Content-Type: application/json" \
-d '{"url":"https://example.com/article"}'If your GitHub README contains:
<!-- READING-LOG:START -->
...
<!-- READING-LOG:END -->You can populate it with the Markdown endpoint:
https://YOUR_WORKER_URL/reading/markdown?limit=5
Point your reading.<domain> to the Worker and it will serve the HTML page at /.
Recommended (Worker Route):
- DNS record: create a
CNAMErecord forreadingthat points to your root domain (@) or any existing hostname in your zone. Make sure it’s proxied (orange cloud). - Worker route: in Cloudflare → Workers & Pages → your worker → Triggers, add a route:
reading.yourdomain.com/*
Alternative (Custom Domain):
If your Cloudflare plan supports Worker custom domains, add reading.yourdomain.com in the worker’s Settings → Domains and Cloudflare will create the DNS record automatically.
Your RSS remains available at:
https://reading.yourdomain.com/reading/rss