# Cloudflare-Email-RSS Create your own RSS (Atom) feeds from emails, processed and hosted by Cloudflare ([free plan](https://www.cloudflare.com/plans/free/)). ## How it works 1. Emails get sent to your configured address on Cloudflare, e.g. `rss-feeds@domain.com` 1. The email gets processed by a Cloudflare worker, each sender address gets it's own feed XML file generated, e.g. `sender@domain.com` -> `sender-domain-com.xml` 1. The feed is stored on Cloudflare R2 and is made accessible, e.g. `https://domain.com/sender-domain-com.xml` 1. An OPML file (`feeds.opml` by default) is maintained in the bucket, keeping a synced list of all feeds 1. Your RSS Reader is configured to fetch this feed file from Cloudflare R2 periodically, or import the OPML file to subscribe to all feeds at once ## What you can do with this 1. Setup [email forwarding](https://support.google.com/mail/answer/10957?hl=en-GB) rules so all your email newsletters (e.g. Substack) gets forwarded to your Cloudflare address or use your Cloudflare address to sign up 1. (Optional) Configure your self-hosted RSS Aggregator (e.g. [FreshRSS](https://github.com/FreshRSS/FreshRSS)) to sync with the generated OPML to fetch all your feeds and keep read / unread status tracked 1. Use a mobile RSS Reader (e.g. [FeedMe](https://play.google.com/store/apps/details?id=com.seazon.feedme)) to sync with FreshRSS / Cloudflare Bucket to download and read your articles ## Cloudflare Setup 1. A [Cloudflare Account](https://dash.cloudflare.com/) and [Domain](https://domains.cloudflare.com/) (needed for email routing) 1. Create [Security Rules](https://developers.cloudflare.com/security/rules/) to control access to your bucket (e.g. limited to your IP / Country / Header / Agent etc) 1. Create a [R2 Bucket](https://developers.cloudflare.com/r2/buckets/public-buckets/) with Public Access (this should still be protected by your previously created Security Rules) 1. Create a [Worker](https://developers.cloudflare.com/workers/), you can link it to your fork of this repo or clone this repo and deploy it manually 1. Set values for the required [Secrets](https://developers.cloudflare.com/workers/wrangler/commands/#secret), see [.env.example](.env.exaple) 1. Enable [Email Routing](https://developers.cloudflare.com/email-routing/), and create a new routing address and rule, and link it to the previously created Worker 1. Use the email address you configured in the Email Routing rule to sign up for newsletters, or forward from your usual email address 1. Configure [Billing Notifications](https://developers.cloudflare.com/notifications/) for when you are hitting the limits of the free plan, for R2 and Workers ## Development - The project uses [Cloudflare Wrangler](https://developers.cloudflare.com/workers/wrangler/) on the CLI - Run: `npx wrangler dev` - Test: `npx vitest` - Deploy: `npx wrangler deploy` - Manage Secrets: `npx wrangler secret` - Generate Types: `npx wrangler types` ## License [MIT](https://choosealicense.com/licenses/mit/)