DEV Community

Cover image for I built an email-to-URL service on Cloudflare Workers — here's what I learned about parsing email threads
Gareth Evans
Gareth Evans

Posted on

I built an email-to-URL service on Cloudflare Workers — here's what I learned about parsing email threads

The problem

Email threads are surprisingly hard to share outside email. Screenshots lose context, forwarding creates quote nesting hell, and copy-paste strips formatting.

I built ThreadCrunch — forward any email thread to share@threadcrunch.io and get a clean, readable URL back in seconds.

The stack

Everything runs on Cloudflare:

  • Email Workers — receive inbound email at custom addresses
  • Workers — API + business logic (TypeScript)
  • D1 — SQLite database
  • Pages — Vue 3 + Tailwind frontend

Total monthly infrastructure cost for a solo SaaS: basically zero until you hit scale.

The hard part: parsing email threads

Every email client formats forwarded threads differently:

Outlook uses separator lines and inline header blocks:

From: Alice
Sent: Monday, March 3, 2026
To: Bob
Subject: Re: Project update
Enter fullscreen mode Exit fullscreen mode

Gmail uses "On {date}, {person} wrote:" followed by > quoted lines.

Webmail (Roundcube, etc.) uses RFC 3676 format=flowed, which joins soft-wrapped lines with trailing spaces. This completely destroys thread structure if you let your MIME parser decode it — I had to strip format=flowed from the Content-Type header before parsing and handle space-stuffing manually.

The fun edge cases:

  • Header fields that wrap across lines (long From/To addresses)
  • Outlook messages containing Gmail-style quoted replies inside them
  • Mixed clients in the same thread (someone replies from Outlook to a Gmail chain)

No signup wall

You don't have to sign up before forwarding. If you're not subscribed, the reply email includes a signup link and your threads get processed automatically once payment goes through.

AI analysis

There's also process@threadcrunch.io which runs the thread through Claude Sonnet for analysis — tone, intent, power dynamics, action items, and a draft reply oriented to the person who forwarded.

The key prompt design insight: doing per-message sequential analysis (tone, emotion, response timing, subtext) before synthesis produces significantly better output than asking for a flat "analyse this thread."

Developer-friendly

Every thread URL has .md and .json endpoints:

  • threadcrunch.io/t/{id}.json — structured JSON
  • threadcrunch.io/t/{id}.md — clean Markdown

Useful if you want to pipe threads into your own LLM tooling or documentation.

Try it

Demo thread: threadcrunch.io/t/5qyi25qv

$5/month, threads auto-delete after 7 days. Would love feedback from the dev community.

Top comments (1)

Collapse
 
agrath profile image
Gareth Evans

Hey dev community! I'm Gareth, the maker.

I built ThreadCrunch as a solo project on Cloudflare's stack. The hardest part was honestly the email parsing - every client formats forwarded threads differently, and RFC 3676 format=flowed from webmail clients was a particularly nasty edge case.

This product was built using Claude but I have significant experience with building web applications and the related technologies so I planned carefully and reviewed security.

Happy to answer any questions!